Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment