/** * Get an applicants tags * @param \Jazzee\Entity\Applicant $applicant */ protected function getTags(\Jazzee\Entity\Applicant $applicant) { $tags = array('tags' => array(), 'allowAdd' => $this->checkIsAllowed($this->controllerName, 'addTag'), 'allowRemove' => $this->checkIsAllowed($this->controllerName, 'removeTag'), 'allTags' => array()); if ($this->checkIsAllowed($this->controllerName, 'addTag')) { foreach ($this->_em->getRepository('\\Jazzee\\Entity\\Tag')->findByApplication($this->_application) as $tag) { $tags['allTags'][] = $tag->getTitle(); } } foreach ($applicant->getTags() as $tag) { $tags['tags'][] = array('id' => $tag->getId(), 'title' => $tag->getTitle()); } return $tags; }