示例#1
0
文件: Session.php 项目: harp-orm/harp
 /**
  * @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;
 }
示例#2
0
 /**
  * @covers            IdentityMap::getId
  * @depends           testObjectCanBeAdded
  * @expectedException OutOfBoundsException
  */
 public function testExceptionIsRaisedForNonExistantObject(IdentityMap $map)
 {
     $map->getId(new StdClass());
 }
示例#3
0
 protected function toIdentityMap(EntityInterface $entity)
 {
     $this->getIdentityMap()->offsetSet($entity->getId(), $entity);
     $this->identityMapOriginal->offsetSet($entity->getId(), clone $entity);
 }