Answer the question
In order to leave comments, you need to log in
How to get data from many to many fields in Symfony and how to implement it?
There are vacancies and for them I get data that is many to many with the help of another request and save it to the array of the current vacancy.
if ($vacancies) {
$ids = array_column((array)$vacancies, 'id');
foreach($vacancies as &$vacancy) {
$vacancy['skills'] = $this->getRowsById($this->skillRepository->getSkillsByVacancyIds($ids), $vacancy['id']);
$vacancy['cities'] = $this->getRowsById($this->cityRepository->getCitiesByVacancyIds($ids), $vacancy['id'], 'name_' . $GLOBALS['request']->getLocale());
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question