Typo3 , extbase mapped entity return no results -
first of all, create extension "extension builder". extend "tt_address" extension.
what steps do?
i create entity
adress
, map existing tablett_address
. in entityaddress
create setter , getter retrieving addressinformations 'city, zip , street'.after step create repository
addressrepository
extends\typo3\cms\extbase\persistence\repository
.the extensionbuilder create typoscript file
ext_typoscript_setup.txt
content:config.tx_extbase{ persistence{ classes{
mab\oaaddress\domain\model\address { mapping { tablename = tt_address recordtype = tx_oaaddress_address } } } }}
i set
storagepid
inconstants.txt
in last step retrieve addresses database , show in list view.
class addresscontroller extends \typo3\cms\extbase\mvc\controller\actioncontroller { /** * events repository * * @var \mab\oaaddress\domain\repository\addressrepository * @inject */ protected $addressrepository; /** * action list * * @return void */ public function listaction() { // exists adress repository? //var_dump($this->addressrepository); $addresses = $this->addressrepository->findall(); //var_dump(count($addresses)); $this->view->assign('addresses', $addresses); }
the table tt_address
contains more ten results. controller show $addresses
count 0
. clear every cache (empty typo3temp folder, empty cache through install tool, emptyh backend cache) nothing have effect. why controller return nothing? can give me tip?
update
after analyse query log, find query executed:
select tt_address.* tt_address 1=1 , (tt_address.tx_extbase_type='tx_oaaddress_address') , tt_address.pid in (148) , tt_address.deleted=0 , tt_address.hidden=0
how can remove part
tt_address.tx_extbase_type='tx_oaaddress_address' part of query?
Comments
Post a Comment