[TYPO3-mvc] calling the findAll in another Action
RAKIBI Anass
anass.rakibi at gmail.com
Fri Dec 5 13:48:10 CET 2014
Hello ,
I have created an extension with 2 Models Country and Company with a 1--* relation . In the list view of the Country Controller , all the countries are listed (into a select ) , On a change event I want to list only Companies that belong to that Country using Ajax ...
The Ajax call is already designed and works fine , it calls an action in the Country controller , this action is designed to look for all companies where country_id = the id passed in the ajax call . here is how this action looks like :
public function getMyCompanysAction()
{
$argument = $this->request->getArguments('id');
$company = $this->entrepriseRepository->findBypays(2);// Repository of Company Model injected
$company->att = 'val';
$company->nom = $company->nom;
$result = (array) $company;
return json_encode($result);
}
the $this->entrepriseRepository->findBypays(2); seems to return always null here , though is returns the exact entry If I use it in ListAction
this way : $this->view->assign('lists', $this->entrepriseRepository->findBypays(2));
What could be the Problem ?
Best Regards
More information about the TYPO3-project-typo3v4mvc
mailing list