Exemplo n.º 1
0
 function it_should_be_invokable(ActionRepository $repository, Criteria $criteria)
 {
     $count = 1;
     $find = array();
     $repository->findByCriteria($criteria)->willReturn($find);
     $repository->countByCriteria($criteria)->willReturn($count);
     $this->setCriteria($criteria);
     $this->execute()->shouldReturn(['result' => $find, 'total' => 1]);
 }
Exemplo n.º 2
0
 /**
  * Creates new entity
  *
  * @return FormInterface
  */
 public function execute()
 {
     $form = $this->formFactory->createNamed('', $this->type);
     $form->handleRequest($this->stack->getCurrentRequest());
     if ($form->isValid()) {
         $object = $form->getData();
         $this->repository->add($object);
         $this->postCreate($object);
         return $object;
     }
     return $form;
 }
Exemplo n.º 3
0
 /**
  * @return array
  */
 public function execute()
 {
     return ['result' => $this->repository->findByCriteria($this->criteria), 'total' => $this->repository->countByCriteria($this->criteria)];
 }
Exemplo n.º 4
0
 /**
  * Creates new entity
  *
  * @return mixed
  */
 public function execute()
 {
     $this->repository->remove($this->object);
     $this->postRemove($this->object);
 }