public function initialize($name = "Unknown", $icon = null){
        if($this->em->getRepository(PageType::class)->findOneByTitle($name) === null){
            $type = new PageType();
            $type->setTitle($name);
            $type->setIcon($icon);
            $this->em->persist($type);
            $this->em->flush();
        }
    }
public function initialize($name = "Unknown", $icon = null){
        if($this->em->getRepository(PageType::class)->findOneByTitle($name) === null){
            $type = new PageType();
            $type->setTitle($name);
            $type->setIcon($icon);
            $this->em->persist($type);
            $this->em->flush();
        }
    }
public function initialize ( $ name = "Unknown" , $ icon = null ) { if ( $ this -> em -> getRepository ( PageType :: class ) -> findOneByTitle ( $ name ) === null ) { $ type = new PageType ( ) ; $ type -> setTitle ( $ name ) ; $ type -> setIcon ( $ icon ) ; $ this -> em -> persist ( $ type ) ; $ this -> em -> flush ( ) ; } }
this function verify the existence of the type and adds it. it's called one time when the cache is cleared
@param string $name
this function verify the existence of the type and adds it . it s called one time when the cache is cleared