Author: Awais Farooq

  • Phalcon Views

    View represents the front-end of the application. It consists of HTML files embedded inside PHP code which creates the view of the application. View provides the data to the web browser from your application. Phalcon\Mvc\View and Phalcon\Mvc\View\Simple are responsible for the managing the view layer of MVC application. Integrating Views with controller Views are automatically integrated when controller…

  • Phalcon Image

    This component allows developers to manipulate image files. We can perform multiple operation on a single image file. Adapters Adapter are used to encapsulate specific image manipulator programs. The following image manipulator programs are supported: Class Description Phalcon\Image\Adapter\Gd Requires the GD PHP extension Phalcon\Image\Adapter\Imagick Requires the ImageMagick PHP extension Implementation Resizing Image We can resize…

  • Phalcon Forms

    It handles creation and maintenance of forms in the web application. Now, as we have designed a basic web-app before we would be adding signup form. Designing Signup form Change the index.phtml viewfile, add the signup page link as a controller. app/views/index/index.phtml OUTPUT: Now, we write the signup controller app/controllers/SignupController.php Initializing Form In this form, we provide…

  • Phalcon Model Transactions

    A model transaction helps to maintain the integrity of the database after the operations such as insert/delete/update/rollback etc. Transaction checks whether the operations are successfully completed or not before committing the database. Transactions are of 3 types: Manual Transactions This method is used when there is only one connection and easy transaction. This transaction can…

  • Phalcon Model Events

    Models allows user to implement events when operation such as insert/update/delete is implemented to define business rules. The following are the events supported by Phalcon\Mvc\Model: Operation Name Description Inserting afterCreate It runs after the required operation over the database system only when an inserting operation is being made. Updating afterUpdate It runs after the required…

  • Phalcon Model Behaviours

    Behaviour is shared conducts which is used by the models to reuse the code. The ORM provides an API to implement behaviours in the models. To implement behaviour we have alternative such as events and callbacks which increases the efficiency of behaviours. Build-in behaviours are as follows: Name Description Timestampable It allows to automatically updates…

  • Phalcon Models

    Model consists of information or data of the application. It manipulates the data by managing the rules. It is found under directory Phalcon\Mvc\Model which remain same for all basic application. It provides following services: Below are the lists of some features which can be Enable/Disable specific feature: Option Description Default astCache Enables/Disables callbacks, hooks and event notifications…

  • Phalcon Query Language (PHQL)

    It allows user to implement query language similar to SQL query language. PHQL is implemented as a parser which connects to RDBMS. Phalcon parser uses same technology as SQLite. PHQL consist of features which are listed below: PHQL Life Cycle PHQL allows developers the ability to personalize and customize accordingly. The following is the lifecycle…

  • Phalcon Transactions and Nested Transactions

    Transaction is supported in Phalcon as it is attached with PDO. To increase the performance of the database we can perform data manipulation. Below is the database structure on which transaction is applied: Transaction example: // Database ‘Company’ data deleted. Nested Transaction Example: // Database ‘Company’ data deleted. Event Name Triggered Break Operation afterConnect After a successfully connection to…

  • Insert/Update/Delete Rows

    Inserting Rows Output: Updating Rows Output: Deleting Rows