O'Reilly logo

Learning Phalcon PHP by Calin Rada

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ORM/ODM operations (create, update, delete, transactions, and validations)

Before we continue, let's make our article table a little more complex, by adding a few columns. We will add three more columns: is_published, created_at, and updated_at.

The is_published field will be a Boolean type (in MySQL, it will have a value of 0 or 1), and the created_at and updated_at fields will have the datetime type. They will hold information about when our article was created and when it was updated. You can alter the article table and add these fields using the following code:

ALTER TABLE `article` ADD `is_published` BOOLEAN NOT NULL DEFAULT FALSE ,
ADD `created_at` DATETIME NOT NULL ,
ADD `updated_at` DATETIME NULL DEFAULT NULL ;

We also need to make modifications ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required