sfPropelUuidBehaviorPlugin - 0.9.0

Propel UUID behavior

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown

sfPropelUuidBehaviorPlugin plugin

The sfPropelUuidBehaviorPlugin is a symfony plugin that provides automatic generation of "Universally Unique IDentifier" for any propel object.

This is based on this specification : http://www.ietf.org/rfc/rfc4122.txt


  • Install the plugin

      symfony plugin-install http://plugins.symfony-project.com/sfPropelUuidBehaviorPlugin
  • Enable Propel behavior support in propel.ini:

      propel.builder.AddBehaviors = true
  • Add necessary fields to your model :


  • Rebuild your database and model

    [sh] symfony propel-build-all

  • Enable the behavior for one of your Propel model:

      // lib/model/Article.php
      class Article
      sfPropelBehavior::add('Article', array('sfPropelUuidBehavior'));

It is possible to specify another column for holding UUIDs :

      // lib/model/Article.php
      class Article

      sfPropelBehavior::add('Article', array('sfPropelUuidBehavior' => 
                                             array('columns' => 
                                                   array('uuid' => MyClassPeer::COLUMN_NAME))));


Each time an object is saved, the behavior will verify validity of its UUID. A new UUID will be attributed to object if it does not already have one or if the one he has is not valid.

Public API


  • (static) string generateUuid() : Generates a Universally Unique IDentifier, version 4
  • (static) string isUuid(string $uuid) : Returns true if supplied string is a valid UUID


2007-03-20 | 0.9 beta

Initial public release.