PHPackages                             wucdbm/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. wucdbm/doctrine-behaviors

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wucdbm/doctrine-behaviors
=========================

Doctrine2 behavior traits

v2.0.0(6y ago)05.7kMITPHPPHP &gt;=5.4

Since Dec 5Pushed 6y ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (18)Used By (0)

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

[](#doctrine2-behaviors)

[![Build Status](https://camo.githubusercontent.com/7f690ce5343def5f435b9eea2f4f3a7e32b7a3e881f64cf4e76fe5af287df579/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f4b6e704c6162732f446f637472696e654265686176696f72732e706e67)](http://travis-ci.org/KnpLabs/DoctrineBehaviors)

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

It currently handles:

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

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:

```
