Ejemplo n.º 1
0
 public static function clearAllCaches()
 {
     self::clearCache();
     self::$__caches->rewind();
     while (self::$__caches->valid()) {
         self::$__caches->setInfo([]);
         self::$__caches->next();
     }
 }
Ejemplo n.º 2
0
 /**
  * Publishes all registered events to their respective event bus.
  */
 protected function publishEvents()
 {
     $this->logger->debug("Publishing events to the event bus");
     if ($this->dispatcherStatus == self::STATUS_DISPATCHING) {
         // this prevents events from overtaking each other
         $this->logger->debug("UnitOfWork is already in the dispatch process. " . "That process will publish events instead. Aborting...");
         return;
     }
     $this->dispatcherStatus = self::STATUS_DISPATCHING;
     $this->eventsToPublish->rewind();
     while ($this->eventsToPublish->valid()) {
         $bus = $this->eventsToPublish->current();
         $events = $this->eventsToPublish->getInfo();
         foreach ($events as $event) {
             $this->logger->debug("Publishing event [{event}] to event bus [{bus}]", array('event' => $event->getPayloadType(), 'bus' => get_class($bus)));
         }
         // clear and send
         $this->eventsToPublish->setInfo(array());
         $bus->publish($events);
         $this->eventsToPublish->next();
     }
     $this->logger->debug("All events successfully published.");
     $this->dispatcherStatus = self::STATUS_READY;
 }
 public function setInfo($data)
 {
     $this->initialize();
     parent::setInfo($data);
 }
Ejemplo n.º 4
0
 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function setInfo($data)
 {
     @trigger_error('The ' . __METHOD__ . ' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
     parent::setInfo($data);
 }
Ejemplo n.º 5
0
 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function setInfo($data)
 {
     $this->triggerDeprecation(__METHOD__);
     parent::setInfo($data);
 }
<?php

$s = new SplObjectStorage();
var_dump($s->setInfo('some_value'));
Ejemplo n.º 7
0
// false
// count()
// 获得映射对象中的对象数量
$obj->count();
// valid()
// 判断对象容器当前指针后面是否有值
$obj->valid();
// key()
// 返回对象容器当前节点的索引
$obj->key();
// rewind()
// 返回并指向第一个节点元素
$obj->rewind();
// setInfo(mixed $data)
// 给当前节点赋值。必须是调用rewind后,才可以用setInfo赋值,否则找不到对象。
$obj->setInfo('AAA');
// getInfo()
// 获得当前节点的值。也必须是调用rewind后,才可以调用getInfo。
$obj->getInfo();
// current()
// 获得当前节点对象
$obj->current();
// getHash()
// 获得参数的hash值
$obj->getHash($a2);
// next()
// 指针移到下一个节点
$obj->next();
// offsetExists
// 判断对象容器中是否存在该对象
$obj->offsetExists($a2);
<?php

$s = new SplObjectStorage();
var_dump($s->setInfo());
Ejemplo n.º 9
0
 /**
  * Sets the data associated with the current iterator entry
  * 
  * @param mixed $data
  */
 protected function setInfo($data)
 {
     $this->filled = true;
     parent::setInfo($data);
 }