[TYPO3-mvc] How to filter output when n:1 relation between objects?
Roland
most.wanted at gmx.at
Tue Nov 8 14:30:24 CET 2011
i tried this ("3" is hardcoded to keep the example simple) in
ProductController.php:
$products =
$this->productRepository->findByBrand($this->brandRepository->findByProducer(3));
i get this error message:
--- quote ---
Fatal error: Call to a member function findByProducer() on a non-object
in
/Users/roland/projects/project-001/typo3conf/ext/rolandproducts/Classes/Controller/ProductController.php
on line 68
--- /quote ---
any suggestions?
Am 08.11.11 14:21, schrieb Roland:
> Am 08.11.11 11:22, schrieb Sören Kracker:
>> You can call $productRepository->findByCountry($country_uid); in your
>> controller. $productRepository is of course an object of your product
>> repository.
>> This works without creating the function findByCountry yourself.
>
> as already mentioned, this works fine for my example.
>
> ADDITIONAL QUESTION:
>
> how about this relations:
>
> Product (aggregate root) --- (n:1) --- Brand (aggregate root) --- (n:1)
> --- Producer
>
> can you handle this via the "repository api" or do you have to us
> "custom queries" to get ALL PRODUCTS OF A CERTAIN PRODUCER?
>
> kind regards.
>
> roland
>
> ps: can it make sense that there are these 2 aggregate roots in my
> domain model?
More information about the TYPO3-project-typo3v4mvc
mailing list