[TYPO3-dev] Persisted Model values are not saved anywhere

Dirk Ho dirk_studivz at web.de
Mon Jul 7 11:21:10 CEST 2014


Hi Xavier,

"(depending if I assign the categories object collection or the string 
the for each loop is commented or not)."
was written beneath the template. The template itself was / is correct, 
I had to mention, that I use cat.title if the loop is not commented. My 
fault.

The problem was / is, that I updated the Extensions Model via Extension 
Builder but old relicts (tables, references in tables / classes) were 
still in the db / model files / ... and that caused the error.

After removing them manually everything worked (so far) quite fine and 
categories are shown in the frontend.

Not sure, if I had to adjust these Extension Builder files how to handle 
generated classes / ... to be merged or whatever or if this is a general 
Extension Builder issue. Now I have the structure and will adjust the 
Model changes,... manually.

Thanks and best wishes,

Dirk

Am 07.07.2014 09:53, schrieb Xavier Perseguers:
> Hi,
>
>> I also adjusted my CategoryController to have a addAction and a
>> listAction. The addAction works so far, but the listAction, which is
>> called when I call the frontend page with my plugin raises the following
>> exception:
>>
>> "Oops, an error occurred!
>> Found an invalid element type declaration in %s. A type "''" does not
>> exist.
>> More information regarding this error might be available online."
>>
>> It makes no difference, if the listAction looks like
>>      public function listAction() {
>>          $this->view->assign('categories', 'BLA');
>>      }
>
> you are assigning a single string instead of what should be an array
>
>> or like
>>      public function listAction() {
>>          $categories = $this->categoryRepository->findAll();
>>          $this->view->assign('categories', $categories);
>>      }
>>
>> The template looks like
>>
>> <ul>
>> <!--f:for each="{categories}" as="cat"-->
>>   <li>{categories}</li>
>> <!--/f:for-->
>> </ul>
>
> Sorry, but what does it mean???
>
> You are commenting out the loop, so with your first example:
>
> $this->view->assign('categories', 'BLA');
>
> you should get
>
> <ul>
>    <li>BLA</li>
> </ul>
>
> as output. But it won't work in the second example because you cannot
> render an "array" coming from Extbase as a string.
>
> Then, your loop should use "cat" and not "categories" inside:
>
> <ul>
>    <f:for each="{categories}" as="cat">
>      <li>{cat.something-here}</li>
>    </f:for>
> </ul>
>
> "cat" is a \Vendor\Extension\Domain\Model\Category object, so you need
> to show something useful, such as its title:
>
> ...
>    <li>{cat.title}</li>
> ...
>
> HTH
>




More information about the TYPO3-dev mailing list