Table::primaryKey PHP Метод

primaryKey() публичный Метод

public primaryKey ( )
    public function primaryKey()
    {
        if ($this->name() && $this->schema()) {
            return $this->primaryKey;
        }
    }

Usage Example

 /**
  * {@inheritDoc}
  */
 public function truncateTableSql(Table $table)
 {
     $name = $this->_driver->quoteIdentifier($table->name());
     $queries = [sprintf('DELETE FROM %s', $name)];
     // Restart identity sequences
     $pk = $table->primaryKey();
     if (count($pk) === 1) {
         $column = $table->column($pk[0]);
         if (in_array($column['type'], ['integer', 'biginteger'])) {
             $queries[] = sprintf('DBCC CHECKIDENT(%s, RESEED, 0)', $name);
         }
     }
     return $queries;
 }
All Usage Examples Of Table::primaryKey