Example #1
0
 /**
  *  Builds a SchemaNode
  *
  *  @access public
  *  @return Faker\Components\Engine\DB\Composite/SchemaNode
  */
 public function end()
 {
     $node = $this->getNode();
     $children = $this->children();
     $compiiler = $this->compiler;
     foreach ($children as $child) {
         $node->addChild($child);
     }
     # run validation routines
     $this->event->dispatch(BuildEvents::onValidationStart, new BuildEvent($this, 'Started validation of entity ' . $this->name));
     $node->validate();
     $this->event->dispatch(BuildEvents::onValidationEnd, new BuildEvent($this, 'Finished validation of entity ' . $this->name));
     # run compiler
     $this->event->dispatch(BuildEvents::onCompileStart, new BuildEvent($this, 'Started compile of entity ' . $this->name));
     $this->compiler->compile($node);
     $this->event->dispatch(BuildEvents::onCompileEnd, new BuildEvent($this, 'Finished compile of entity ' . $this->name));
     $this->event->dispatch(BuildEvents::onBuildingEnd, new BuildEvent($this, 'Finished build of entity ' . $this->name));
     return $node;
 }