/** * Very important in order to save the related entities! * @param \Chamilo\CoreBundle\Entity\Session $session * @return mixed|void */ public function preUpdate($session) { $session->setCourses($session->getCourses()); }