/**
  * Checks if given $intention supports auto-validation.
  *
  * @param IntentionInterface $intention
  *
  * @return boolean
  */
 protected function supports(IntentionInterface $intention)
 {
     if (!$intention instanceof ParametersIntentionInterface) {
         return false;
     }
     return $intention->isAutoValidatable();
 }
Example #2
0
 /**
  * Injects paging parameters into given $intention.
  *
  * @param PagingAwareIntentionInterface|IntentionInterface $intention
  */
 public function inject(IntentionInterface $intention)
 {
     $request = $this->requestStack->getCurrentRequest();
     $intention->setLimit($request->query->get('limit', $this->defaultLimit));
     $intention->setOffset($request->query->get('offset', $this->defaultOffset));
 }
Example #3
0
 /**
  * Injects an instance of Symfony\Component\Validator\Validator\ValidatorInterface into given $intention.
  *
  * @param ParametersIntentionInterface|IntentionInterface $intention
  */
 public function inject(IntentionInterface $intention)
 {
     $intention->setValidator($this->validator);
 }
 /**
  * Injects an instance of Doctrine\ORM\EntityManagerInterface into given $intention.
  *
  * @param DbAwareIntentionInterface|IntentionInterface $intention
  */
 public function inject(IntentionInterface $intention)
 {
     $intention->setEntityManager($this->entityManager);
 }