ugosansh/doctrine-bundle

Doctrine tools bundle

v3.0.1 2014-12-20 18:48 UTC

README

doctrine-bundle provide a simple EntityManager, EntityRepository and base php traits from Symfony 2 application

Installation

Add to your composer.json :

{
    "require": {
        "ugosansh/doctrine-bundle": "~1.0"
    }
}

Update your vendors :

composer update ugosansh/doctrine-bundle

AppKernel

class AppKernel extends \Symfony\Component\HttpKernel\Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Wn\Bundle\DoctrineBundle\WnDoctrineBundle(),
        );
    }
}

Use

Manager
use Wn\Bundle\DoctrineBundle\Manager\Manager;

class MyManager extends Manager
{

}

Interface

  __construct(EntityManager $entityManager, $repositoryName);
  createEntity() : mixed
  getEntityName() : string
  getRepository() : Doctrine\ORM\EntityRepository
  getRepositoryName() : string
  save(mixed $entity, boolean $flush = true) : boolean
  remove(mixed $entity) : boolean
  find(integer $id) : mixed
  findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) : mixed
  findIn(array $ids) : mixed
  count(array $criteria) : integer
Repository
use Wn\Bundle\DoctrineBundle\Repository\EntityRepository;

class MyRepository extends EntityRepository
{

}

Interface

  findIn(array $ids) : mixed
  count(array $criteria) : integer

Traits

doctrine-bundle define actualy 4 traits from data fields

# Wn\Bundle\DoctrineBundle\Entity\Traits

 - DateBirthField
 - DateCreateField
 - DateUpdateField
 - DateDeleteField

License

ugosansh/doctrine-bundle is licensed under the MIT License