Пример #1
0
 /**
  * @return AbstractProtoClass
  **/
 public function skipObjectPrefetching(Identifiable $object)
 {
     if ($this->depth) {
         if (!isset($this->skipList[$this->depth][$object->getId()])) {
             $this->skipList[$this->depth][$object->getId()] = 1;
         } else {
             ++$this->skipList[$this->depth][$object->getId()];
         }
     }
     return $this;
 }
Пример #2
0
 protected function cacheById(Identifiable $object, $expires = Cache::EXPIRES_FOREVER)
 {
     if ($expires !== Cache::DO_NOT_CACHE) {
         Cache::me()->mark($this->className)->set($this->makeIdKey($object->getId()), ['tags' => $this->getTagsForObject($object), 'data' => $object], $expires);
     }
     return $object;
 }
Пример #3
0
 public function merge(Identifiable $object, $cacheOnly = true)
 {
     Assert::isNotNull($object->getId());
     $this->checkObjectType($object);
     $old = Cache::worker($this)->getCachedById($object->getId());
     if (!$old) {
         // unlikely
         if ($cacheOnly) {
             return $this->save($object);
         } else {
             $old = Cache::worker($this)->getById($object->getId());
         }
     }
     if ($object === $old) {
         return $this->save($object);
     }
     return $this->unite($object, $old);
 }
Пример #4
0
 /**
  * @return BinaryExpression
  **/
 public static function eqId($field, Identifiable $object)
 {
     return self::eq($field, DBValue::create($object->getId()));
 }
Пример #5
0
 public function drop(Identifiable $object)
 {
     return $this->dropById($object->getId());
 }
Пример #6
0
 private function addObjectToMap(Identifiable $object)
 {
     return $this->identityMap[$object->getId()] = $object;
 }