/** * Adds new Role * * @param $name * @param Role|NULL $parent * @param bool $flush * * @return Role|bool */ public function addRole($name, Role $parent = NULL, $flush = FALSE) { if ( ! $this->findRoleByName( $name ) ) { $role = new Role( $name, $parent ); $this->em->persist( $role ); if ( $flush ) $this->em->flush(); return $role; } return FALSE; }