| @@ 64-77 (lines=14) @@ | ||
| 61 | return $this->getService($service . 'repository.'.$resource); |
|
| 62 | } |
|
| 63 | ||
| 64 | protected function findOneBy($type, array $criteria, $repoPrefix = '') |
|
| 65 | { |
|
| 66 | $resource = $this |
|
| 67 | ->getRepository($type, $repoPrefix) |
|
| 68 | ->findOneBy($criteria); |
|
| 69 | ||
| 70 | if (null === $resource) { |
|
| 71 | throw new \InvalidArgumentException( |
|
| 72 | sprintf('%s for criteria "%s" was not found.', str_replace('_', ' ', ucfirst($type)), serialize($criteria)) |
|
| 73 | ); |
|
| 74 | } |
|
| 75 | ||
| 76 | return $resource; |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * @Given /^I am on the (.+) (page)?$/ |
|
| @@ 480-493 (lines=14) @@ | ||
| 477 | return $this->getService($service . 'repository.'.$resource); |
|
| 478 | } |
|
| 479 | ||
| 480 | protected function findOneBy($type, array $criteria, $repoPrefix = '') |
|
| 481 | { |
|
| 482 | $resource = $this |
|
| 483 | ->getRepository($type, $repoPrefix) |
|
| 484 | ->findOneBy($criteria); |
|
| 485 | ||
| 486 | if (null === $resource) { |
|
| 487 | throw new \InvalidArgumentException( |
|
| 488 | sprintf('%s for criteria "%s" was not found.', str_replace('_', ' ', ucfirst($type)), serialize($criteria)) |
|
| 489 | ); |
|
| 490 | } |
|
| 491 | ||
| 492 | return $resource; |
|
| 493 | } |
|
| 494 | ||
| 495 | protected function validate($data) |
|
| 496 | { |
|