[TYPO3-german] extbase add statement

g4-lisz at tonarchiv.ch g4-lisz at tonarchiv.ch
Fri Feb 7 22:30:20 CET 2014


Du Diu nur einmal ein Cat Objekt mit new erzeugst, wird immer das selbe
Objekt hinzu gefügt. Ergo: Die Zeile mit new muss auch in die Schleife
mit rein!

Grüße,
Till

On 02/07/2014 09:40 PM, arianesardinas wrote:
> Hallo Leute
>
> ich möchte die methode add in eine schleife ausführen.
>
>
> in controller:
> /**
>      * occupationcategoryRepository
>      *
>      * @var \TYPO3\JobsDfu\Domain\Repository\OccupationcategoryRepository
>      * @inject
>      */
>     protected $occupationcategoryRepository;
> public function meineAction() {
> $newCat = new \TYPO3\JobsDfu\Domain\Model\Occupationcategory();
>
>    foreach ($response as $key => $value) {
>     $newCat->setName($value->name);
>     $this->occupationcategoryRepository->add($newCat);           
>    }
> }
>
> Leider wir nur eine den letzten Eintrag eingefügt, praktisch
> überschrieben. Hat jeamnd eine Idee, wie man mehrere Einträge
> hintereinder insertet?
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german



More information about the TYPO3-german mailing list