コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     $this->manager = EntityManagerFactory::getNewManager();
     $this->createSchema($this->manager);
     $this->repo = $this->getRepo();
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public function commit()
 {
     EntityManagerFactory::getSingleton()->flush();
     $this->connection->commit();
 }
コード例 #5
0
 protected function getParams()
 {
     return EntityManagerFactory::getDbParams();
 }