protected function getGClass() { if (!isset($this->gClass)) { $this->gClass = $this->entityMeta->getGClass(); $this->gClass->elevateClass(); } return $this->gClass; }
/** * Elevated die ParentClass um properties der Hierarchy laden zu können */ public function setParentClass(GClass $gClass) { $this->class->setParentClass($gClass); if ($gClass->exists()) { try { // damit die gclass vernünftig initialisiert wird $this->class->elevateParent(); } catch (\Psc\Code\Generate\ReflectionException $e) { throw new \Psc\Exception('Die Parent-Klasse: ' . $gClass->getFQN() . ' kann nicht elevated werden. Das ist schlecht, denn so können nicht alle methoden korrekt vererbt werden oder properties erstellt werden.' . 'Die SyntaxFehler der Klasse müssen zuerst behoben werden', 0, $e); } } return $this; }
public function compile() { $gClass = new \Psc\Code\Generate\GClass(\Psc\Code\Code::getClass($this)); $gClass->elevateClass(); $this->log('compiling ProjectEntities:'); foreach ($gClass->getMethods() as $method) { if (\Psc\Preg::match($method->getName(), '/^compile[a-z0-9A-Z_]+$/') && $method->isPublic()) { $this->modelCompiler = NULL; // neuen erzeugen damit flags resetted werden, etc $m = $method->getName(); $this->log(' ' . $m . ':'); try { $out = $this->{$m}($this->getModelCompiler()); } catch (\Doctrine\DBAL\DBALException $e) { if (mb_strpos($e->getMessage(), 'Unknown column type') !== FALSE) { $types = A::implode(\Doctrine\DBAL\Types\Type::getTypesMap(), "\n", function ($fqn, $type) { return $type . "\t\t" . ': ' . $fqn; }); throw new \Psc\Exception('Database Error: Unknown Column Type: types are: ' . "\n" . $types, $e->getCode(), $e); } throw $e; } catch (\Exception $e) { $this->log(' Fehler beim Aufruf von ' . $m); throw $e; } if ($out instanceof \Webforge\Common\System\File) { $this->log(' ' . $out . ' geschrieben'); } elseif (is_array($out)) { foreach ($out as $file) { $this->log(' ' . $file . ' geschrieben'); } } elseif ($out instanceof \Psc\Doctrine\EntityBuilder) { $this->log(' ' . $out->getWrittenFile() . ' geschrieben'); } } } $this->log('finished.'); return $this; }