[TYPO3-mvc] Extension Builder and realtions
Sven Hofacker
info at ho-it.de
Sun Jun 23 20:25:51 CEST 2013
Hi Anja,
many thanks for your example!!
I use Typo3 6.0 an if i use prependOptionLabel i get the message "Argument
"prependOptionLabel" was not registered"
Without this option, the select field is empty.
I use the debugging
"\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($agencies);" in the
Controller .. and in the frontEnd i see the agencies but the select field
is empty :-(
Sven
Am 23.06.13 10:35 schrieb "Anja Leichsenring" unter
<aleichsenring at ab-softlab.de>:
>Hi Sven,
>
>inside your controller, you need to retrieve all the agencies from the
>persistence and pass them to the view. Then you can create there a
>selectfield. I give an (untested) example:
>
>Controller:
>namespace Vendor\Extension\Controller;
>class CustomerController ... {
> /**
> * @var \Vendor\Extension\Domain\Repository\CustomerRepository
> * @inject
> */
> protected customerRepository;
>
> /**
> * @var \Vendor\Extension\Domain\Repository\AgencyRepository
> * @inject
> */
> protected agencyRepository;
>
> public function newAction() {
> $agencies = $this->agencyRepository->findAll();
> $this->view->assign('agencies', $agencies);
> }
>}
>
>Template Customer/New.html:
><f:form action="create" object="customer">
> ...
> <f:form.select property="agency" options="{agencies}"
>prependOptionLabel="please select" />
> ...
></f:form>
>
>I hope that helps
>Anja
>
>On 06/23/2013 10:11 AM, Sven Hofacker wrote:
>> Hi there,
>>
>> i will build an Extension with the Extension Builder 6.
>> I create 2 Models, Model 1 = Agency and Model 2 = Customer
>> Model 2 has a Relation to Model 1 (Agency)
>>
>> I create 3 Agencys in the Backend. If i create a Customer in the
>>Backend, i
>> see the three Agencys in the select field and i can select one of them.
>> So the Agency will get a Customer ;-)
>>
>> I build a Frontend Plugin also. I can create the Agencys, but if i try
>>to
>> create a customer, then there is no select field!
>> What must i write in the Controller or New.html File to get the Agency
>> select field?
>>
>> I will hope, you can understand my Problem . sry for my english ..
>>
>> Sven Hofacker (DE)
>>
>>
>
>_______________________________________________
>TYPO3-project-typo3v4mvc mailing list
>TYPO3-project-typo3v4mvc at lists.typo3.org
>http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
More information about the TYPO3-project-typo3v4mvc
mailing list