/** * Standard constructor */ public function __construct(PgClass $pgClass, array $options, $entityFileStoreBase = null) { $this->pgClass = $pgClass; $this->options = $options; $this->entityFileStore = $entityFileStoreBase . '/' . $this->pgClass->getEntityName(); $this->class = new PhpClass($this->pgClass->getEntityName(), $options['entity'], false); $this->references = $this->pgClass->getReferences(); $this->normalityTags = $this->pgClass->getTags(); $this->dataTypes = DataType::makeFromRelation($this->pgClass); $this->loadUnsettableProperties(); $this->loadLateLoadProperty(); $this->loadKeyProperties(); // create entity filestore directory structure. if (!is_dir($this->entityFileStore)) { mkdir($this->entityFileStore, 0755, true); } // readonly property if ($this->pgClass->isLogTable()) { $this->isReadOnly = 'READONLY_ON_PERSIST'; } if ($this->pgClass->isView() or $this->pgClass->isMaterialisedView()) { $this->isReadOnly = 'READONLY_EXCEPTION'; } if (array_key_exists('isReadOnly', $this->normalityTags)) { $this->isReadOnly = $this->normalityTags['isReadOnly']; } // $this->class->classComponents[] = new ClassConstant( // 'REPOSITORY_NAMESPACE', // new Sformatf( <<<'PHP' // /** // * Repository Location // */ // const REPOSITORY_NAMESPACE = '%s'; // PHP // , addslashes( $this->options['repository'] ) // ) // ); $this->class->classComponents[] = new ClassConstant('ENTITY_FILESTORE', new Sformatf(<<<'PHP' /** * Entity FileStore directory */ const ENTITY_FILESTORE = '%s'; PHP , addslashes($this->entityFileStore))); $this->getClassExtends(); $this->getGetSetFunction(); $this->getSqlInterfaceFunction(); $this->setClassComment(); $this->getUnsettablePropertiesDeclaration(); $this->getAdditionalPropertiesDeclaration(); $this->getLateLoadPropertyDeclaration(); $this->getKeyPropertiesDeclaration(); $this->getIsReadOnlyPropertyDeclaration(); $this->getDataDeclaration(); $this->getIsZombieFunction(); $this->getSymfonyloadValidatorMetadataFunction(); }
public function testEntity() { $catalog = new Catalog($this->connectionFactory->get('RW')); $a4r = $catalog->pgClasses->findOneByName('a4'); $a4t = DataType::makeFromRelation($a4r); foreach ($a4t as $type) { $this->assertSame($type->entity, $a4r->getEntityName()); } }