コード例 #1
0
 /**
  * @param VisitorInterface $visitor
  * @param array $data
  * @param array $type
  * @return ArrayCollection
  */
 public function deserialize(VisitorInterface $visitor, $data, array $type)
 {
     if (!$data) {
         return new ArrayCollection();
     }
     $tasks = [];
     foreach ($data as $uuid) {
         $tasks[] = $this->taskManager->getReference($uuid);
     }
     return new ArrayCollection($tasks);
 }
コード例 #2
0
 public function testAnnotation()
 {
     $task = new Task();
     $task->setDescription('foo');
     $task->addAnnotation(new Annotation('testbar'));
     $this->taskManager->save($task);
     $task = $this->taskManager->find($task->getUuid());
     $annotations = $task->getAnnotations();
     $this->assertCount(1, $annotations);
     $this->assertEquals('testbar', $annotations[0]->getDescription());
     $task->addAnnotation(new Annotation('blabla'));
     $this->taskManager->save($task);
     $task = $this->taskManager->find($task->getUuid());
     $annotations = $task->getAnnotations();
     $this->assertCount(2, $annotations);
     $this->assertEquals('testbar', $annotations[0]->getDescription());
     $this->assertEquals('blabla', $annotations[1]->getDescription());
     $task->removeAnnotation($annotations[0]);
     $this->taskManager->save($task);
     $task = $this->taskManager->find($task->getUuid());
     $annotations = $task->getAnnotations();
     $this->assertCount(1, $annotations);
     $this->assertEquals('blabla', $annotations[0]->getDescription());
     $task->setAnnotations([new Annotation('foo'), new Annotation('bar')]);
     $this->taskManager->save($task);
     $task = $this->taskManager->find($task->getUuid());
     $annotations = $task->getAnnotations();
     $this->assertCount(2, $annotations);
     $this->assertEquals('foo', $annotations[0]->getDescription());
     $this->assertEquals('bar', $annotations[1]->getDescription());
 }
コード例 #3
0
 /**
  * @return int
  */
 public function count()
 {
     return $this->taskManager->count($this->filter);
 }