Skip to content

Instantly share code, notes, and snippets.

@suburbanworrier
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save suburbanworrier/89174fda98765489bc52 to your computer and use it in GitHub Desktop.

Select an option

Save suburbanworrier/89174fda98765489bc52 to your computer and use it in GitHub Desktop.
findByUid issue
/**
* 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));
}
<?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;
}
}
<?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