Working with Models (Advanced)

Hydration Modes As mentioned previously, resultsets are collections of complete objects, this means that every returned result is an object representing a row in the database. These objects can be modified and saved again to persistence: use Store\Toys\Robots; $robots = Robots::find(); // Manipulating a resultset of complete objects foreach ($robots as $robot) { $robot->year = 2000; $robot->save(); } Sometimes records are obtained only to be presented to a user in read-only mo

Working with Namespaces

Namespaces can be used to avoid class name collisions; this means that if you have two controllers in an application with the same name, a namespace can be used to differentiate them. Namespaces are also useful for creating bundles or modules. Setting up the framework Using namespaces has some implications when loading the appropriate controller. To adjust the framework behavior to namespaces is necessary to perform one or all of the following tasks: Use an autoload strategy that takes into acc

Working with Models

A model represents the information (data) of the application and the rules to manipulate that data. Models are primarily used for managing the rules of interaction with a corresponding database table. In most cases, each table in your database will correspond to one model in your application. The bulk of your application’s business logic will be concentrated in the models. Phalcon\Mvc\Model is the base for all models in a Phalcon application. It provides database independence, basic CRUD functi

View Helpers (Tags)

Writing and maintaining HTML markup can quickly become a tedious task because of the naming conventions and numerous attributes that have to be taken into consideration. Phalcon deals with this complexity by offering Phalcon\Tag, which in turn offers view helpers to generate HTML markup. This component can be used in a plain HTML+PHP view or in a Volt template. This guide is not intended to be a complete documentation of available helpers and their arguments. Please visit the Phalcon\Tag page

Volt: Template Engine

Volt is an ultra-fast and designer friendly templating language written in C for PHP. It provides you a set of helpers to write views in an easy way. Volt is highly integrated with other components of Phalcon, just as you can use it as a stand-alone component in your applications. Volt is inspired by Jinja, originally created by Armin Ronacher. Therefore many developers will be in familiar territory using the same syntax they have been using with similar template engines. Volt’s syntax and fe

Version::VERSION_SPECIAL

integer VERSION_SPECIAL

Version::VERSION_SPECIAL_NUMBER

integer VERSION_SPECIAL_NUMBER

Version::VERSION_MAJOR

integer VERSION_MAJOR

Version::VERSION_MEDIUM

integer VERSION_MEDIUM

Version::getPart

public static getPart (mixed $part) Returns a specific part of the version. If the wrong parameter is passed it will return the full version echo Phalcon\Version::getPart(Phalcon\Version::VERSION_MAJOR);