Last active
August 29, 2015 14:01
-
-
Save suburbanworrier/89174fda98765489bc52 to your computer and use it in GitHub Desktop.
findByUid issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * modelRepository | |
| * | |
| * @var \Pistil\Vehicles\Domain\Repository\ModelRepository | |
| * @inject | |
| */ | |
| protected $modelRepository = NULL; | |
| /** | |
| * brandRepository | |
| * | |
| * @var \Pistil\Vehicles\Domain\Repository\BrandRepository | |
| * @inject | |
| */ | |
| protected $brandRepository = NULL; | |
| /** | |
| * typeRepository | |
| * | |
| * @var \Pistil\Vehicles\Domain\Repository\TypeRepository | |
| * @inject | |
| */ | |
| protected $typeRepository = NULL; | |
| /** | |
| * action type | |
| * | |
| * @param \Pistil\Vehicles\Domain\Model\Type $type | |
| * @return void | |
| */ | |
| public function typeAction(\Pistil\Vehicles\Domain\Model\Type $type) { | |
| $this->view->assign('brands', $this->brandRepository->findByType($type)); | |
| $this->view->assign('type', $this->typeRepository->findByUid($type)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Pistil\Vehicles\Domain\Repository; | |
| class ModelRepository extends \TYPO3\CMS\Extbase\Persistence\Repository { | |
| /** | |
| * @param \Pistil\Vehicles\Domain\Model\Brand $brand | |
| * @param \Pistil\Vehicles\Domain\Model\Type $type | |
| * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface | |
| */ | |
| public function findByTypeAndBrand($type, $brand) { | |
| $query = $this->createQuery(); | |
| $models = $query | |
| ->matching( | |
| $query->logicalAnd( | |
| $query->equals('brand', $brand), | |
| $query->equals('type', $type) | |
| ) | |
| ) | |
| ->execute(); | |
| return $models; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Pistil\Vehicles\Domain\Repository; | |
| /** | |
| * The repository for Types | |
| */ | |
| class TypeRepository extends \TYPO3\CMS\Extbase\Persistence\Repository { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment