[TYPO3-dev] Extbase mapping "pages" table

Luigi Tenti ltenti at gmail.com
Fri Apr 26 15:13:06 CEST 2013


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.



More information about the TYPO3-dev mailing list