PHPackages                             unifik/doctrine-behaviors-bundle - 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. unifik/doctrine-behaviors-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

unifik/doctrine-behaviors-bundle
================================

Doctrine Behaviors for Symfony2, using traits.

113.8k7[2 issues](https://github.com/egzakt/UnifikDoctrineBehaviorsBundle/issues)2PHP

Since Oct 4Pushed 9y ago9 watchersCompare

[ Source](https://github.com/egzakt/UnifikDoctrineBehaviorsBundle)[ Packagist](https://packagist.org/packages/unifik/doctrine-behaviors-bundle)[ RSS](/packages/unifik-doctrine-behaviors-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (2)

UnifikDoctrineBehaviorsBundle
=============================

[](#unifikdoctrinebehaviorsbundle)

This bundle is highly inspired from [KnpLabs/DoctrineBehaviors](https://github.com/KnpLabs/DoctrineBehaviors). Some behaviors have been modified because they didn't accomplish exactly what we wanted.

New behaviors have been added : Uploadable, Metadatable and Taggable.

The original behaviors have been wrapped in a Symfony2 bundle.

*PHP 5.4 is required because we use traits*.

For now, these behaviors are available :

- [Translatable](#translatable)
- [TranslatableEntityRepository](#translatableentityrepository)
- [Sluggable](#sluggable)
- [Timestampable](#timestampable)
- [Uploadable](#uploadable)
- [Metadatable](#metadatable)
- [Taggable](#taggable)
- [Blameable](#blameable)
- [SoftDeletable](#softdeletable)

How to use
----------

[](#how-to-use)

### Translatable

[](#translatable)

#### The entities

[](#the-entities)

You have to generate both Translatable and Translation entities. For example, Text and TextTranslation :

```
# Text.orm.yml
Unifik\SystemBundle\Entity\Text:
  type: entity
  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO
    createdAt:
      type: datetime
      gedmo:
        timestampable:
          on: create
    updatedAt:
      type: datetime
      gedmo:
        timestampable:
          on: update
```

```
# TextTranslation.orm.yml
Unifik\SystemBundle\Entity\TextTranslation:
  type: entity
  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO
    text:
      type: text
    name:
      type: string
      length: 255
      nullable: true
    active:
      type: boolean
      nullable: true
```

In the Translatable entity, add a `use` statement to include the `Translatable` trait

```
