Easy Doctrine Extensions will make you happy
Published on
Apr 26, 2011
Apr 27, 2011 − If you're following our little life at Knp, you probably know that Gediminas (aka l3pp4rd) has been working with us in France for the past 2 months. It's time to get to know his work a little better!
If you're following our little life at Knp, you probably know that Gediminas (aka l3pp4rd) has been working with us in France for the past 2 months. It's time to get to know his work a little better!
With the community's help, Gediminas has been creating and maintaining some very nice − and popular − extensions for Doctrine2.
- Sluggable - urlizes a given field into a single unique slug
- Timestampable - updates date fields when your object is created, updated and even when a specific property is changed
- Tree - this extension automates the tree handling process and adds some tree specific functions to the repository. (closure or nestedset)
- Translatable - gives you a very handy solution for translating records into different languages. Easy to setup, easier to use.
- Loggable - helps tracking changes and history of objects, also supports version management.
Here's the really good news:
- it's easy to use. A simple annotation in your model or a little YML file will add the desired behaviour and make you happy.
- it's damn quick. Let's keep performances in mind so that you can use these extensions in your big beautiful projects.
- If you're a Mongo fan. Please know that the DoctrineExtensions do support both the Doctrine2 ORM and the Doctrine2 ODM.
Quick examples:
<?php
class Post
{
/**
* @gedmo:Sluggable
* @Column(length=64)
*/
private $title;
/**
* @gedmo:Slug
* @Column(length=64, unique=true)
*/
private $slug;
/**
* @gedmo:Timestampable(on="create")
* @Column(type="datetime")
*/
private $created;
}
Easy, isn't it?
If you want to know more, check out the Github repository, read the docs in the docs
folder, and give Gediminas some love!
Comments