[Flow] Simple database query

Carsten Bleicker carsten at bleicker.de
Wed Jan 7 10:13:19 CET 2015


you need something like this in your action:

$classname = 'Acme\Foo\Domain\Model\Whatever';
$query = $this->persistenceManager->createQueryForType($classname);

/** @var \Acme\Foo\Domain\Model\Whatever $whatever */
$whatever = $query->matching($query->equals('email', $email))->execute()->getFirst();
$this->view->assign('name', $whatever->getName());


----------------------

Carsten Bleicker
Wülfingstraße 1
42477 Radevormwald

E-Mail:	carsten at bleicker.de
Web:	www.bleicker.de
Twitter:	@carstenbleicker
Jabber:	cbleicker at jabber.ccc.de
Telefon:	+49 (0)171-2690845

Am 07.01.2015 um 09:03 schrieb Patric Eckhart <mail at patriceckhart.com>:

> Hey,
> 
> I will create a simple database query but it doesn't work.
> And then I would have the value from the column "name" in my view.
> 
> /**
> * @Flow\Inject
> * @var \TYPO3\Flow\Persistence\Doctrine\Query
> */
>    protected $doctrineQuery;
> 
> /**
> * @param string $email
> * @return void
> */
> public function myAction($email){
> $query = $this->doctrineQuery->getResult();
> $query->$this->doctrineQuery->matching($query->$this->doctrineQuery->equals($email))->setLimit(10)->execute();
> $this->view->assign('name', $query);
> }
> 
> I'm very grateful for your help!!!
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow



More information about the Flow mailing list