示例#1
0
 /**
  * @param Driver            $driver Parent driver.
  * @param AbstractCommander $commander
  * @param string            $name   Table name, must include table prefix.
  * @param string            $prefix Database specific table prefix.
  */
 public function __construct(Driver $driver, AbstractCommander $commander, $name, $prefix)
 {
     parent::__construct($name);
     $this->driver = $driver;
     $this->commander = $commander;
     $this->prefix = $prefix;
     //Locking down initial table state
     $this->initial = new TableState($name);
     //Needed to compare schemas
     $this->comparator = new Comparator($this->initial, $this);
     if (!$this->driver->hasTable($this->getName())) {
         //There is no need to load table schema when table does not exist
         return;
     }
     //Loading table information
     $this->loadColumns()->loadIndexes()->loadReferences();
     //Syncing schemas
     $this->initial->syncSchema($this);
     $this->exists = true;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function hasTable($name)
 {
     return $this->driver->hasTable($this->tablePrefix . $name);
 }
示例#3
0
 /**
  * @param string $name        Table name, must include table prefix.
  * @param string $tablePrefix Database specific table prefix.
  * @param Driver $driver
  */
 public function __construct($name, $tablePrefix, Driver $driver)
 {
     $this->name = $name;
     $this->tablePrefix = $tablePrefix;
     $this->driver = $driver;
     if (!$this->driver->hasTable($this->name)) {
         return;
     }
     //Loading table information
     $this->loadColumns();
     $this->loadIndexes();
     $this->loadReferences();
     $this->exists = true;
 }