[TYPO3-mvc] FLUID :: how can you access properties of m:n related objects?

Henjo Hoeksma me at henjohoeksma.nl
Thu Nov 3 11:51:34 CET 2011


Hi Roland,

I am sorry, German words tend to confuse me ;-)

If I understood correctly, the Zulassungen are related to the Procukt,
correct?

In that case it would be possible to retrieve it like this in your
showAction:

$firstZulassung = $product->getZulassungen()->getFirst();

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Thu, Nov 3, 2011 at 11:42, Roland <most.wanted at gmx.at> wrote:

>  You can also assign a variable in the controller. Not specifically need
>> for
>> a ViewHelper.
>>
>
> and the variable would hold the first "Zulassung", right? but where has
> the variable be defined?
>
> now, there is this getter in my Produkt.php:
>
> --- quote ---
> **
>  *
>  *
>  */
>
>
> public function getFirstZulassung() {
>        $object = $this->getZulassungen(); // Or whatever
>        $object->rewind();
>        if ($object->valid()) {
>                return $object->current();
>        }
> }
> --- /quote ---
>
> this should get the first Zulassung object, right? how can i assign this
> to the view?
>
> this is how my list action in the ProduktController.php looks like:
>
>
> --- quote ---
>
>        /**
>         * action list
>         *
>         * @return void
>         */
>        public function listAction() {
>                $produkts = $this->produktRepository->**findAllOrdered(array('name'
> => Tx_Extbase_Persistence_**QueryInterface::ORDER_**ASCENDING));
>                $firstZulassung = $this->getFirstZulassung();
>                $this->view->assign('produkts'**, $produkts);
>                $this->view->assign('**firstZulassung', $firstZulassung);
>        }
>
> --- /quote ---
>
> unfortunatelly as mentioned this does not work...
>
> ______________________________**_________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>


More information about the TYPO3-project-typo3v4mvc mailing list