/**
  * @param Table $table
  * @return string
  */
 public function resolveFacadeFilename(Table $table)
 {
     return $this->config->get('facade.folder') . DIRECTORY_SEPARATOR . $this->normalize(ucfirst($table->getName()) . $this->config->get('facade.filename.suffix')) . '.' . IFilenameResolver::PHP_EXT;
 }
Example #2
0
 /**
  * @param Table $table
  */
 protected function analyseIndexes(Table $table)
 {
     $tableName = $table->getName();
     // Analyse indexes
     $indexes = $this->driver->getIndexes($tableName);
     $keys = $this->driver->getForeignKeys($tableName);
     foreach ($indexes as $index) {
         foreach ($index['columns'] as $col) {
             $column = $table->getColumn($col);
             $column->setPrimary($index['primary']);
             $column->setUnique($index['unique']);
             $column->setIndex(TRUE);
         }
     }
     foreach ($keys as $key) {
         $column = $table->getColumn($key['local']);
         $column->setForeignKey($foreign = new ForeignKey());
         $foreign->setSourceTable($table->getName());
         $foreign->setSourceColumn($key['local']);
         $foreign->setReferenceTable($key['table']);
         $foreign->setReferenceColumn($key['foreign']);
     }
 }
Example #3
0
 /**
  * @param Table $table
  */
 public function addTable(Table $table)
 {
     $table->attach($this);
     $this->tables[] = $table;
 }
Example #4
0
 /**
  * @param Table $table
  * @return string
  */
 protected function table(Table $table)
 {
     return $this->normalize(ucfirst($table->getName()));
 }
 /**
  * @param Table $table
  * @return string
  */
 public function resolveFacadeName(Table $table)
 {
     return $this->normalize(ucfirst($table->getName()) . $this->config->get('facade.name.suffix'));
 }