[TYPO3-dev] Extbase mapping "pages" table
Benjamin Beck
BenjaminBeck at gmx.de
Fri Apr 26 17:06:14 CEST 2013
Hi Luigi,
the extension "pw_teaser" has a working implementation of a Extbase-Page-Model.
public function getSelfAndSiblings() {
$this->cacheSelfAndSiblings = $this->pageRepository->findChildrenByPidList(this->getPid());
}
Benjamin
On 26.04.2013, at 15:13, Luigi Tenti <ltenti at gmail.com> wrote:
> Hi,
>
> in one of my extensions I would like to get the list of pages that are
> siblings of the one I put a plugin into.
> I created a model class "Pagina" in the file /Classes/Domain/Model/Pagina.php:
>
> namespace MyCompany\MyExtension\Domain\Model:
>
> class Pagina extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
> protected $title;
> public function getTitle() {
> return $this->title;
> }
> public function setTitle($title) {
> $this->title = $title;
> }
> }
>
> I created a repository class "PaginaRepository" in the file
> /Classes/Domain/Repository/PaginaRepository.php:
>
> namespace MyCompany\MyExtension\Domain\Repository;
>
> class PaginaRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
>
> }
>
> I put some TS in the /Configuration/TypoScript/setup.txt:
>
> config.tx_extbase.persistence.classes {
> MyCompany/MyExtension/Domain/Model/Pagina {
> mapping {
> tableName = pages
> columns {
> title.mapOnProperty = title
> }
> }
> }
> }
>
> Finally I tried to get all the pages (just to start) and put in my controller:
>
> /**
> * paginaRepository
> *
> * @var \MyCompany\MyExtension\Domain\Repository\PaginaRepository
> * @inject
> */
> protected $paginaRepository;
> /**
> * action list
> *
> * @return void
> */
> public function listAction() {
> $pagine = $this->paginaRepository->findAll();
> ....
> }
>
> But when I try to see the result of the query I get:
>
> "#1247602160: Table 'typo3.tx_myextension_domain_model_pagina' doesn't
> exist: SELECT COUNT(*) FROM tx_myextension_domain_model_pagina"
>
> What's wrong in my code ?
> Thanks a lot !
>
> Luigi.
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
More information about the TYPO3-dev
mailing list