doctrineflow-framework

typo3 flow: variable in repository


I´d like to use a variable in a typo3 flow repository. With

$letter = $_POST['someVariable'];

it works with my following Repository:

public function findLetter() {

            $letter = $_POST['letter'];

            $query = $this->createQuery();
            $query->matching(
                    $query->like('name', $letter)
                    );
            return $query->execute();
}

I read that it should also be possible in typo3 flow to get variables by

$letter = $this->request->getArgument('someVariable');

but this doesn´t work for me; I get the following error:

#1: Notice: Undefined property: ......\Domain\Repository\MitgliedRepository::$request in /var/www/apps/flow/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/..._..._Domain_Repository_...Repository.php line 96

line 96 in ...Repository is that:

$letter = $this->request->getArgument('letter');

Does anybody know, what I´m doing wrong?


Solution

  • I got it:

    My Controller now looks linke that:

    /**
     * @return void
     * @param string $letter
     */
    public function letterAction($letter) {
        $this->view->assign('mitglieder', $this->mitgliedRepository->findLetter($letter));
    }
    

    And my Repository looks like that:

    /**
     * @return string
     */
    public function findLetter($letter) {
        $query = $this->createQuery();
        $query->matching(
            $query->like('name', $letter)
            )
            ->setOrderings(array('name' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING));
        return $query->execute();
    }