private function createRole($name) { $cod = $name; // string (20) $rank = strlen($name); // Quick and dirty way to keep it unique $xml = '<xml content and definition of this/>'; $display = true; $text = 'Black then white are all i see in my infancy.'; $role = new Role(); $role->setCod($cod); $role->setRank($rank); $role->setXml($xml); $role->setDisplay($display); // true by default $role->setName($name); $role->setText($text); $role->increaseNumberPeopleInMultimediaObject(); $this->dm->persist($role); $this->dm->flush(); return $role; }