29/03
2016
dev-master
9999999-dev
MIT
The Requires
The Development Requires
by Kauri Kont-Kontson
Wallogit.com
2017 © Pedro Peláez
Wrapped on top of different database connectors to provide general interface. Currently supports only Doctrine ORM., (*2)
// Create directly
$em = new DoctrineEntityManager($entityManager);
// Create using factory (recommended)
$em = new EntityManagerFactory($containerBuilder)->create('doctrine_entity_manager');
// Get single entity
$entity = $em->get('Entities\Product', 1);
// Get single entity (with additional criterias)
$entity = $em->get('Entities\Product', 1, array('user_id' => 2));
// Get collection
$entityCollection = $em->getCollection('Entities\Product');
// Create new entity
$newEntity = $em->create('Entities\Product', array('name' => 'foo'));
// Update newly created entity
$updatedEntity = $em->update('Entities\Product', $newEntity->getId(), array('name' => 'bar'));
// Delete update entity
$em->delete('Entities\Product', $updatedEntity->getId());
As all existing Doctrine functionality is left intact you are also able to use all Doctrine ORM build in methods:, (*3)
$em = new DoctrineEntityManager($entityManager);
$user = new User;
$user->setName('Mr.Right');
$em->persist($user);
$em->flush();
MIT