The archivable behavior gives model objects the ability to be copied to an archive table. In the schema.xml add the archivable behavior in a tag for a table.

Example: After rebuilding the table the model will have one additional table user_archive, with the same columns as the original user table. Table user_archive stores the archived users together with their archive date (the newest copy of each archived objects). To archive an object, call the archive() method on particular object. AutoAddPk The auto_add_pk behavior adds primary key columns to the tables. Add the schema.xml in the table definition tag .

The behavior adds an id column of type integer and autoincremented. ReferenceIntegrity Delegate The ReferenceIntegrity behavior automates the reference integrity for referenced documents. For example, if you set ReferenceIntegrity to ‘nullify’ it would then automatically remove referenced association when removing an entity. The delegate behavior allows you to relate tables. For example, in the schema.xml add the delegate behavior in the tag for a table. In the tag specify the delegated table. Table a and b are then related by a ‘created by’ behavior foreign primary key in the b table. Translatable i18n The translatable behavior enables you to keep data with the related appropriate locale. $article = new Entity\Article; $article->setTitle('my title in en'); $article->setContent('my content in en'); $em->persist($article); $em->flush(); $article = $em->find('Entity\Article', 1 /*article id*/); $article->setTitle('my title in de'); $article->setContent('my content in de'); $article->setTranslatableLocale('de_de'); // change locale $em->persist($article); $em->flush(); The i18n behavior is used in applications that support several languages. It allows you to keep several translations of the text data for single objects. In schema.xml for a table definition add the tag with a tag that specifies the columns that need internationalization.

The internalizated columns have been moved to newly created table a_i18n. The new table contains a locale column and shares a many-to-one relationship with the a table. Tree Nested set The tree nested behavior implements the standard Nested-Set behavior on the Entity. The nested_set behavior allows a model to become a tree structure. In the schema.xml in the table definition add tag . After rebuilding the model, it can now be inserted into a tree structure. Query cache The query_cache behavior gives a speed boost to Propel queries by caching the transformation of a PHP Query object into reusable SQL code.

In the schema.xml in the table definition add the tag . After rebuilding the model, all the queries on this object can now be cached. Slugabble The sluggable behavior builds the slug (URL friendly version of post title) of predefined fields. Example of usage $a1 = new A(); $a1->setTitle('Hello, World!'); $this->em->persist($a); $this->em->flush(); echo $a1->getSlug(); // 'hello-world' The sluggable behavior allows a model to offer a human readable identifier. In the schema.xml in the table definition add the tag . A unique slug is automatically composed for every object that you save. It can be used to provide user-friendly URLs. Example of usage $a1 = new A(); $a1->setTitle('Hello, World!'); $a1->save(); echo $a1->getSlug(); // 'hello-world' Sortable The sortable behavior maintains a position field for ordering entities. The model has the ability to become an ordered list. The sortable behavior allows a model to become an ordered list. In the schema.xml in the table definition add the tag . Propel gives the new object the first available rank in the list. Validate The validate behavior provides validating capabilities to ActiveRecord objects. Using this behavior, you can perform validation of an ActiveRecord and its related objects, checking if properties meet certain conditions. In the schema.xml in the table definition add the tag . Then add validation rules in the tag. Loggable Versionable The loggable behavior tracks your record changes and is able to manage versions. The versionable behavior provides versioning capabilities to any ActiveRecord object. Using this behavior, you can: Revert an object to previous versions easily

Track and browse history of the modifications of an object

Keep track of the modifications in related objects Blameable The blameable behavior automates the update of username or user reference fields on the entities or documents. It works similar to timestampable behavior. It simply inserts the current user id into the fields created_by and updated_by. That way every time a model gets created or updated, you can see who did it (or who blame for that). Softdeleteable The softdeleteable behavior allows you to “soft delete” objects, filtering them at SELECT time by marking them as with a timestamp, but not explicitly removing them from the database. Uploadable The uploadable behavior provides the tools to manage the persistence of files with Doctrine 2, including automatic handling of moving, renaming and removal of files and other features, for example: to generate sha1 filename for the file

set a maximum size for the file in bytes IpTraceable The IpTraceable behavior automates the update of IP trace on entities or documents. It works similar to timestampable behavior but sets a string if particular column marked as ‘ipTracable’ is updated on create, update or change. SYMFONY FRAMEWORK Symfony supports both ORMs. When you generate a new project with Symfony, you can set it up for Propel or Doctrine. $ php symfony generate:project foo --orm=Doctrine $ php symfony generate:project foo --orm=Propel Which PHP ORM do you use and why? Feel free to express your opinion! Subscribe to our newsletter Join our weekly newsletter to be notified about the latest posts. Subscribe You may also like docs How to Generate Propel’s Schema.xml File From a Database Model Created in Vertabelo Read more