public function setUp() { parent::setUp(); $this->manager = EntityManagerFactory::getNewManager(); $this->createSchema($this->manager); $this->repo = $this->getRepo(); }
public function __construct($em = null) { if (!class_exists($this->type)) { throw new \DomainException('protected property $type must specify fully qualified Entity class name'); } if (is_null($em)) { $em = EntityManagerFactory::getSingleton(); } if (!is_a($em, 'Doctrine\\ORM\\EntityManager')) { throw new \InvalidArgumentException('Repository must be constructed with an instance of Doctrine\\ORM\\EntityManager'); } $this->manager = $em; }
public function test_omitting_entity_manager_will_default_manager_to_singleton_manager() { $this->repo = new UserRepository(); $manager = $this->getObjectValue($this->repo, 'manager'); $this->assertSame(EntityManagerFactory::getSingleton(), $manager); }
public function commit() { EntityManagerFactory::getSingleton()->flush(); $this->connection->commit(); }
protected function getParams() { return EntityManagerFactory::getDbParams(); }