Esempio n. 1
0
 /**
  * @return DB
  */
 public function add(AbstractModel $model)
 {
     if ($this->identityMap->hasIdentityKey($model)) {
         $model = $this->identityMap->get($model);
     } else {
         $this->new->attach($model);
     }
     $this->attach($model);
     return $this;
 }
Esempio n. 2
0
 /**
  * @covers            IdentityMap::getId
  * @depends           testObjectCanBeAdded
  * @expectedException OutOfBoundsException
  */
 public function testExceptionIsRaisedForNonExistantObject(IdentityMap $map)
 {
     $map->getId(new StdClass());
 }
Esempio n. 3
0
 protected function toIdentityMap(EntityInterface $entity)
 {
     $this->getIdentityMap()->offsetSet($entity->getId(), $entity);
     $this->identityMapOriginal->offsetSet($entity->getId(), clone $entity);
 }