[TYPO3-dev] EXTBASE Repository.

Christian Tauscher christian.tauscher at media-distillery.de
Sat Mar 21 21:43:27 CET 2015


Hello.

I have a DB table printitem.
A second table category which printitem is categoized.

In Create/Edit Mode I want a select field with category.

fluid.partial:
---------------
<f:form.select property="substrate" options="{categoryOptions}" />



/**
  * action edit
  *
  * @param \Tmd\screenprinting\Domain\Model\Printitem $printitem
  * @ignorevalidation $printitem
  * @return void
  */
public function editAction(\Tmd\screenprinting\Domain\Model\Printitem 
$printitem) {
   $this->view->assign('printitem', $printitem);
   $allItems = $this->CategoryRepository->findAll();

   foreach($allItems as $item) {
     $options[$item->getUid()] = $item->getName();
   }
   $this->view->assign('categoryOptions', $options);
}


The Problem:
in $options is not the Expected Array of Category but of Printitem.

???

What is wrong.
I have added Class/Controller/Repositpry/CategoryRepository.php whith no 
other result.

<?php
namespace Tmd\Screenprinting\Domain\Repository;
/**
  * The repository for Category
  */
class CategoryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
}


Next try:
I habe a next table branch. Same as bevor, only different Name.

changin the CategoryRepository zu branch
   $allItems = $this->branchRepository->findAll();

leads to.

Fatal error: Call to a member function findAll() on a non-object in 
.../screenprinting/Classes/Controller/PrintitemController.php on line 158



WTF....





Thank you for your help,

Christian

PS:
rm * typo3temp/Cache/*,
clearing cache in BE does not help.



More information about the TYPO3-dev mailing list