/** * Very important in order to save the related entities while creation. * @param Course $course * @return mixed|void */ public function prePersist($course) { $course->setUsers($course->getUsers()); $course->setUrls($course->getUrls()); $this->updateTools($course); }