| @@ 8-30 (lines=23) @@ | ||
| 5 | use Behat\Behat\Context\Context; |
|
| 6 | use Sylius\Component\Resource\Repository\RepositoryInterface; |
|
| 7 | ||
| 8 | final class CustomBlockContext implements Context |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var RepositoryInterface |
|
| 12 | */ |
|
| 13 | private $repository; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param RepositoryInterface $repository |
|
| 17 | */ |
|
| 18 | public function __construct(RepositoryInterface $repository) |
|
| 19 | { |
|
| 20 | $this->repository = $repository; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @Transform :customBlock |
|
| 25 | */ |
|
| 26 | public function nameToDocument($name) |
|
| 27 | { |
|
| 28 | return $this->repository->findOneBy(['name' => $name]); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| @@ 8-30 (lines=23) @@ | ||
| 5 | use Behat\Behat\Context\Context; |
|
| 6 | use Sylius\Component\Resource\Repository\RepositoryInterface; |
|
| 7 | ||
| 8 | final class ProductBlockContext implements Context |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @var RepositoryInterface |
|
| 12 | */ |
|
| 13 | private $repository; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param RepositoryInterface $repository |
|
| 17 | */ |
|
| 18 | public function __construct(RepositoryInterface $repository) |
|
| 19 | { |
|
| 20 | $this->repository = $repository; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @Transform :productBlock |
|
| 25 | */ |
|
| 26 | public function nameToDocument($name) |
|
| 27 | { |
|
| 28 | return $this->repository->findOneBy(['name' => $name]); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||