コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     if ($this->container->hasParameter('pugx_shortid_doctrine.length')) {
         $factory = new Factory();
         $factory->setLength($this->container->getParameter('pugx_shortid_doctrine.length'));
         $alphabet = $this->container->getParameter('pugx_shortid_doctrine.alphabet');
         if (!empty($alphabet)) {
             $factory->setAlphabet($alphabet);
         }
         Shortid::setFactory($factory);
     }
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function generate(EntityManager $manager, $entity)
 {
     return Shortid::generate();
 }