PHPackages                             petegore/doctrine-behaviors - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. petegore/doctrine-behaviors

ActiveLibrary[Database &amp; ORM](/categories/database)

petegore/doctrine-behaviors
===========================

Doctrine2 behavior traits

1.5.0(9y ago)11661MITPHPPHP &gt;=5.4

Since Dec 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/petegore/DoctrineBehaviors)[ Packagist](https://packagist.org/packages/petegore/doctrine-behaviors)[ Docs](http://knplabs.com)[ RSS](/packages/petegore-doctrine-behaviors/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (7)Versions (19)Used By (0)

Doctrine2 Behaviors
===================

[](#doctrine2-behaviors)

This PHP `>=5.4` library is a collection of traits and interfaces that add behaviors to Doctrine2 entites and repositories.

It's exactly the same as base Knp/DoctrineBehaviours and add the Uuidable feature.

It currently handles:

- [blameable](#blameable)
- [filterable](#filterable)
- [geocodable](#geocodable)
- joinable
- [loggable](#loggable)
- [sluggable](#sluggable)
- [softDeletable](#softDeletable)
- sortable
- [timestampable](#timestampable)
- [translatable](#translatable)
- [tree](#tree)
- \[uuidable\] (#uuidable)

Notice:
-------

[](#notice)

Some behaviors (translatable, timestampable, softDeletable, blameable, geocodable) need Doctrine subscribers in order to work. Make sure to activate them by reading the [Subscribers](#subscribers) section.

\##Installation `composer require knplabs/doctrine-behaviors:~1.1`

Configuration
-------------

[](#configuration)

By default, when integrated with Symfony, all subscribers are enabled (if you don't specify any configuration for the bundle). But you can enable behaviors you need in a whitelist manner:

```
knp_doctrine_behaviors:
    blameable:      false
    geocodable:     ~     # Here null is converted to false
    loggable:       ~
    sluggable:      true
    soft_deletable: true
    # All others behaviors are disabled
```

Subscribers
-----------

[](#subscribers)

If you use symfony2, you can easily register them in:

- *Recommended way:*

Add to AppKernel

```
class AppKernel
{
    function registerBundles()
    {
        $bundles = array(
            //...
            new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
            //...
        );

        //...

        return $bundles;
    }
}
```

- *Deprecated way:*Importing a service definition file:

```
    # app/config/config.yml
    imports:
        - { resource: ../../vendor/knplabs/doctrine-behaviors/config/orm-services.yml }
```

You can also register them using doctrine2 api:

```
