[FLOW3-general] cannot get objects from repository

Thomas Mammitzsch thomas at visualworx.de
Wed Dec 5 11:47:33 CET 2012


sure! see below or here http://pastebin.com/9MM94KXm

*controller:*

namespace Acme\Demo\Controller;

use TYPO3\Flow\Annotations as Flow;

/**
  * Ajax controller for the Acme.Demo package
  *
  * @Flow\Scope("singleton")
  */
class AjaxController extends \TYPO3\Flow\Mvc\Controller\ActionController {

     /**
      * @var array
      * @see 
http://git.typo3.org/FLOW3/Packages/TYPO3.FLOW3.git?a=commit;h=03b6d85916e46ed8b2e99bc549d7248957dca935
      */
     protected $supportedMediaTypes = array('text/html', 
'application/json');

     /**
      * @var array
      */
     protected $viewFormatToObjectNameMap = array('json' => 
'TYPO3\Flow\Mvc\View\JsonView');

     /**
      * @Flow\Inject
      * @var Acme\Demo\Domain\Repository\ScoutobjectRepository
      */
     protected $scoutobjectRepository;

     /**
      * autocomplete user input
      *
      * @return void
      */
     public function autocompleteAction() {
         $term = $this->request->getArgument('term');
         $objects = 
$this->scoutobjectRepository->findCityForAutocompletion($term);
         $objects2 = $this->scoutobjectRepository->findAll();
     }
}


*Repository*

namespace Acme\Demo\Domain\Repository;

/**
  * A repository for ScoutObjects
  *
  * @Flow\Scope("singleton")
  */
class ScoutobjectRepository extends \TYPO3\Flow\Persistence\Repository {

	// add customized methods here
     public function findCityForAutocompletion($term) {
         $query = $this->createQuery();
         $query->matching($query->like('gemeinde', $term.'%', FALSE));
         $results = $query->execute();

         $query2 = $this->createQuery();
         $query2->matching($query2->equals('gemeinde', 'Essen'));
         $results2 = $query2->execute();

         return $results;
     }
}

Am 05.12.2012 11:19, schrieb Bastian Waidelich:
 >
 > Can you post some code for us to verify?
 >



More information about the FLOW3-general mailing list