예제 #1
0
 /**
  * @When I find cars where the property :name is :value
  */
 public function iFindCarsThatHavePropertyValue($name, $value)
 {
     $restriction = Restrictions::equalTo($name, $value);
     $criteria = new Criteria();
     $criteria->addRestriction($restriction);
     $this->cars = $this->repository->findBy($criteria);
 }
예제 #2
0
 /**
  * @Given the list :listName has the following criteria:
  */
 public function theListHasTheFollowingCriteria($listName, TableNode $table)
 {
     $criteria = new Criteria(new ArrayCollection());
     foreach ($table->getHash() as $restriction) {
         if (in_array($restriction['key'], array('signup', 'last_open', 'last_click', 'dob'))) {
             $value = new \DateTime($restriction['value']);
             $value = $value->format('U');
         } else {
             $value = $restriction['value'];
         }
         $method = $restriction['name'];
         $criteria->addRestriction(Restrictions::$method($restriction['key'], $value));
     }
     $this->lists[$listName] = $criteria;
 }