Exemplo n.º 1
0
 function generate_classes()
 {
     $this->em->getConfiguration()->setMetadataDriverImpl(new DatabaseDriver($this->em->getConnection()->getSchemaManager()));
     $cmf = new DisconnectedClassMetadataFactory();
     $cmf->setEntityManager($this->em);
     $metadata = $cmf->getAllMetadata();
     $generator = new EntityGenerator();
     $generator->setUpdateEntityIfExists(true);
     $generator->setGenerateStubMethods(true);
     $generator->setGenerateAnnotations(true);
     $generator->generate($metadata, APPPATH . "models/Entities");
 }
Exemplo n.º 2
0
 /**
  * Generate, and return the attribute.
  *
  * The value returned is the id of the generated model, if applicable.
  *
  * @return int|null
  */
 public function generate()
 {
     $model = parent::generate();
     return $this->getId($model);
 }