/**
  * {@inheritdoc}
  */
 public function process(ActionInterface $action, EntryCollection $collection)
 {
     $users = $this->getUsers();
     foreach ($users as $user) {
         $collection->add(new EntryUnaware($this->userClass, $user[0]->getId()), 'SONATA_ADMIN');
     }
 }
Example #2
0
 /**
  * @param ActionInterface $action action
  *
  * @return EntryCollection
  */
 public function processSpreads(ActionInterface $action)
 {
     if ($this->onSubject) {
         $this->entryCollection->add(new Entry($action->getSubject()), 'GLOBAL');
     }
     foreach ($this->spreads as $spread) {
         if ($spread->supports($action)) {
             $spread->process($action, $this->entryCollection);
         }
     }
     return $this->getEntryCollection();
 }
 public function testClear()
 {
     $this->if($collection = new TestedModel())->and($this->mockClass('\\Spy\\Timeline\\Spread\\Entry\\EntryInterface', '\\Mock'))->and($entry = new \Mock\EntryInterface())->and($entry->getMockController()->getIdent = 'ident1')->when($collection->add($entry, 'NOTGLOBAL'))->object($collection->getIterator())->isEqualTo(new \ArrayIterator(array('NOTGLOBAL' => array('ident1' => $entry), 'GLOBAL' => array('ident1' => $entry))))->when($collection->clear())->object($collection->getIterator())->isEqualTo(new \ArrayIterator(array()));
 }