コード例 #1
0
 public function __construct($data, $parent)
 {
     parent::__construct($data, $parent);
     
     // collect tables
     foreach($this->data->xpath("value") as $key => $node){
         $tmp = \MwbExporter\Core\Registry::get('formatter')->createTable($node, $this);
         
         if($tmp->isTranslationTable()){
             // skip translation tables
             continue;
         }
         
         $this->tables[] = $tmp;
     }
     
     usort($this->tables, function($a, $b) {
        return strcmp($a->getModelName(), $b->getModelName()); 
     });
     
     /*
      * before you can check for foreign keys
      * you have to store at first all tables in the
      * object registry
      */
     foreach($this->tables as $table){
         $table->checkForIndices();
         $table->checkForForeignKeys();
     }
     
     \MwbExporter\Core\Registry::set($this->id, $this);
 }
コード例 #2
0
    public function __construct($data, $parent)
    {
        parent::__construct($data, $parent);
        
        // iterate on foreign key configuration
        foreach($this->data->value as $key => $node){
            $attributes         = $node->attributes();         // read attributes

            $key                = (string) $attributes['key']; // assign key
            $this->config[$key] = (string) $node[0];           // assign value
        }
        
        // follow references to tables
        foreach($this->data->link as $key => $node){
            $attributes         = $node->attributes();         // read attributes
            $key                = (string) $attributes['key']; // assign key
            
            if($key == 'referencedTable'){
                $referencedTableId = (string) $node;
                $this->referencedTable = \MwbExporter\Core\Registry::get($referencedTableId);
            }
            
            if($key == 'owner'){
                $owningTableId = (string) $node;
                $this->owningTable = \MwbExporter\Core\Registry::get($owningTableId);
                $this->owningTable->injectRelation($this);
            }
        }
        
        //print_r($this->debug());
        //die();
        
        \MwbExporter\Core\Registry::set($this->id, $this);
    }
コード例 #3
0
 /**
  *
  * @param type $data
  * @param type $parent 
  */
 public function __construct($data, $parent)
 {
     parent::__construct($data, $parent);
 
     $tmp = $this->data->xpath("value[@key='schemata']");
     $this->schemas = \MwbExporter\Core\Registry::get('formatter')->createSchemas($tmp[0], $this);
     
     \MwbExporter\Core\Registry::set($this->id, $this);
 }
コード例 #4
0
 public function __construct($data, $parent)
 {
     parent::__construct($data, $parent);
     
     foreach($data->value as $key => $node){
         $this->foreignKeys[] = \MwbExporter\Core\Registry::get('formatter')->createForeignKey($node, $this);
     }
     
     \MwbExporter\Core\Registry::set($this->id, $this);
 }
コード例 #5
0
 public function __construct($data, $parent)
 {
     parent::__construct($data, $parent);
     
     foreach($this->data->xpath("value") as $key => $node){
         $this->schemas[] = \MwbExporter\Core\Registry::get('formatter')->createSchema($node, $this);
     }
     
     \MwbExporter\Core\Registry::set($this->id, $this);
 }
コード例 #6
0
 public function __construct($data, $parent)
 {
     parent::__construct($data, $parent);
    
     foreach($this->data as $key => $node){
         $this->columns[] = \MwbExporter\Core\Registry::get('formatter')->createColumn($node, $this);
     }
     
     \MwbExporter\Core\Registry::set($this->id, $this);
 }
コード例 #7
0
 public function __construct($data, $parent)
 {
     parent::__construct($data, $parent);
     
     // iterate on views
     foreach($data->value as $key => $node){
         $this->views[] = \MwbExporter\Core\Registry::get('formatter')->createView($node, $this);
     }
     
     \MwbExporter\Core\Registry::set($this->id, $this);
 }
コード例 #8
0
    public function __construct($mwbFile, \MwbExporter\Core\IFormatter $formatter)
    {
        // load mwb simple_xml object
        $this->data = \MwbExporter\Core\Helper\Mwb::readXML($mwbFile);

        // save formatter in registry
        \MwbExporter\Core\Registry::set('formatter', $formatter);

        // save document in registry
        \MwbExporter\Core\Registry::set('document', $this);
        $this->parse();

        // save this object in registry by workebench id
        \MwbExporter\Core\Registry::set($this->id, $this);
    }
コード例 #9
0
    public function __construct($data, $parent)
    {
        parent::__construct($data, $parent);

        $tmp = $this->data->xpath("value[@key='name']");
        $this->name = (string) $tmp[0];
        
        $tmp = $this->data->xpath("value[@key='tables']");
        $this->tables = \MwbExporter\Core\Registry::get('formatter')->createTables($tmp[0], $this);

        $tmp = $this->data->xpath("value[@key='views']");
        $this->views  = \MwbExporter\Core\Registry::get('formatter')->createViews($tmp[0], $this);
        
        \MwbExporter\Core\Registry::set($this->id, $this);
    }
コード例 #10
0
    /**
     *
     * @param SimpleXMLElement $data
     * @param \MwbExporter\Core\Model\Tables $parent
     */
    public function __construct($data, $parent)
    {
        parent::__construct($data, $parent);

        $tmp = $this->data->xpath("value[@key='columns']");
        $this->columns = \MwbExporter\Core\Registry::get('formatter')->createColumns($tmp[0], $this);

        // iterate on column configuration
        foreach($this->data->value as $key => $node){
            $attributes         = $node->attributes();         // read attributes

            $key                = (string) $attributes['key']; // assign key
            $this->config[$key] = (string) $node[0];           // assign value
        }

        \MwbExporter\Core\Registry::set($this->id, $this);
    }
コード例 #11
0
    public function __construct($data, $parent)
    {
        parent::__construct($data, $parent);

        //iterate on column configuration
        foreach($this->data->value as $key => $node){
            $attributes         = $node->attributes();         // read attributes
            $key                = (string) $attributes['key']; // assign key
            $this->config[$key] = (string) $node[0];           // assign value
        }

        // iterate on links to other wb objects
        foreach($this->data->link as $key => $node){
            $attributes         = $node->attributes();
            $key                = (string) $attributes['key'];
        }

        $isPrimary = false;
        // check for primary columns, to notify column
        $nodes = $this->data->xpath("value[@key='columns']/value/link[@key='referencedColumn']");
        if(is_array($nodes)){
            foreach($nodes as $node){
                // for primary indexes ignore external index
                // definition and set column to primary instead
                if($this->config['name'] == 'PRIMARY'){
                    $isPrimary = true;
                    \MwbExporter\Core\Registry::get((string) $node)->markAsPrimary();
                } else {
                    if($this->config['indexType'] == 'UNIQUE'){
                        \MwbExporter\Core\Registry::get((string) $node)->markAsUnique();
                    }
                    $this->referencedColumn[] = \MwbExporter\Core\Registry::get((string) $node);
                }
            }
        }
        if($isPrimary) {
            return;
        }
        \MwbExporter\Core\Registry::get((string)$this->data->link)->injectIndex($this);
        \MwbExporter\Core\Registry::set($this->id, $this);
    }
コード例 #12
0
    public function __construct($data, $parent)
    {
        parent::__construct($data, $parent);

        // iterate on column configuration
        foreach($this->data->xpath("value") as $key => $node){
            $attributes         = $node->attributes();         // read attributes

            $key                = (string) $attributes['key']; // assign key
            $this->config[$key] = (string) $node[0];           // assign value
        }

        // iterate on links to other wb objects
        foreach($this->data->xpath("link") as $key => $node){
            $attributes         = $node->attributes();

            $key                = (string) $attributes['key'];
            $this->link[$key]   = (string) $node[0];
        }

        \MwbExporter\Core\Registry::set($this->id, $this);
    }
コード例 #13
0
 public function __construct(array $setup=array()){
     \MwbExporter\Core\Registry::set('config', $setup);
     DatatypeConverter::setUp();
 }
コード例 #14
0
 /**
  *
  * @param array $setup 
  */
 public function __construct(array $setup=array()){
     $setup = array_merge($this->_defaultZendConfig, $setup);
     
     \MwbExporter\Core\Registry::set('config', $setup);
 }