[FLOW3-general] array and property mapping
Pankaj Lele
pankaj at lelesys.com
Tue Apr 9 22:52:58 CEST 2013
Hi Winfried,
> $array=$this->someRepository->findAll()->toArray();
> returns a very complex array.
> How can I get a simpler array containing only properties and values?
Having results in an array sounds little bit going away from Domain
Driven Design.
However if you need the results as simple as key => value then you can
try executing a DQL query and hydrate resutls as an array. To do this
try extending your repository class to
"TYPO3\Flow\Persistence\Doctrine\Repository" and then using
$this->entityManager->createQuery('DQL')->execute(params,
\Doctrine\ORM\Query::HYDRATE_ARRAY) you will get flat array result
based on your select clause.
Note: When you use DQL queries you will not get benefits of some
ViewHelpers like Paginate which are based on the default QOM of Flow.
--
Pankaj Lele
CTO - Lelesys, India
http://www.lelesys.com
Twitter: @pankajlele
More information about the FLOW3-general
mailing list