[TYPO3-dev] Extbase mapping "pages" table
Luigi Tenti
ltenti at gmail.com
Fri Apr 26 20:52:25 CEST 2013
Thanks Benjamin I will download and inspect this extension !
2013/4/26 Benjamin Beck <BenjaminBeck at gmx.de>:
> 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
>
> _______________________________________________
> 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