getColumns() public method

Returns the names of the columns in the table.
public getColumns ( ) : array
return array
Ejemplo n.º 1
0
 /**
  * Returns the names of the columns in the table.
  *
  * @return array
  */
 public function getColumns()
 {
     if (!empty($this->includeColumns)) {
         return array_values(array_intersect($this->originalMetaData->getColumns(), $this->includeColumns));
     } elseif (!empty($this->excludeColumns)) {
         return array_values(array_diff($this->originalMetaData->getColumns(), $this->excludeColumns));
     } else {
         return $this->originalMetaData->getColumns();
     }
 }
 /**
  * Asserts that the given tableMetaData matches this tableMetaData.
  *
  * @param PHPUnit_Extensions_Database_DataSet_ITableMetaData $other
  */
 public function matches(PHPUnit_Extensions_Database_DataSet_ITableMetaData $other)
 {
     if ($this->getTableName() != $other->getTableName() || $this->getColumns() != $other->getColumns()) {
         return FALSE;
     }
     return TRUE;
 }
Ejemplo n.º 3
0
 /**
  * Creates the query necessary to pull all of the data from a table.
  *
  * @param  PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData
  * @return unknown
  */
 public static function buildTableSelect(PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData, PHPUnit_Extensions_Database_DB_IDatabaseConnection $databaseConnection = NULL)
 {
     if ($tableMetaData->getTableName() == '') {
         $e = new Exception('Empty Table Name');
         echo $e->getTraceAsString();
         throw $e;
     }
     $columns = $tableMetaData->getColumns();
     if ($databaseConnection) {
         $columns = array_map([$databaseConnection, 'quoteSchemaObject'], $columns);
     }
     $columnList = implode(', ', $columns);
     if ($databaseConnection) {
         $tableName = $databaseConnection->quoteSchemaObject($tableMetaData->getTableName());
     } else {
         $tableName = $tableMetaData->getTableName();
     }
     $primaryKeys = $tableMetaData->getPrimaryKeys();
     if ($databaseConnection) {
         $primaryKeys = array_map([$databaseConnection, 'quoteSchemaObject'], $primaryKeys);
     }
     if (count($primaryKeys)) {
         $orderBy = 'ORDER BY ' . implode(' ASC, ', $primaryKeys) . ' ASC';
     } else {
         $orderBy = '';
     }
     return "SELECT {$columnList} FROM {$tableName} {$orderBy}";
 }
Ejemplo n.º 4
0
 /**
  * Returns the names of the columns in the table.
  *
  * @return array
  */
 public function getColumns()
 {
     return array_values(array_diff($this->originalMetaData->getColumns(), $this->excludeColumns));
 }
Ejemplo n.º 5
0
 /**
  * Asserts that the given tableMetaData matches this tableMetaData.
  *
  * @param PHPUnit_Extensions_Database_DataSet_ITableMetaData $other
  */
 public function assertEquals(PHPUnit_Extensions_Database_DataSet_ITableMetaData $other)
 {
     if ($this->getTableName() != $other->getTableName()) {
         throw new Exception("Expected table name of {$this->getTableName()}, has a name of {$other->getTableName()}");
     }
     if ($this->getColumns() != $other->getColumns()) {
         throw new Exception("Expected following columns: " . implode(', ', $this->getColumns()) . "; has columns: " . implode(', ', $other->getColumns()));
     }
     return TRUE;
 }
Ejemplo n.º 6
0
 /**
  * Creates the query necessary to pull all of the data from a table.
  *
  * @param PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData
  * @return unknown
  */
 public static function buildTableSelect(PHPUnit_Extensions_Database_DataSet_ITableMetaData $tableMetaData)
 {
     if ($tableMetaData->getTableName() == '') {
         $e = new Exception("Empty Table Name");
         echo $e->getTraceAsString();
         throw $e;
     }
     $columnList = implode(', ', $tableMetaData->getColumns());
     $primaryKeys = $tableMetaData->getPrimaryKeys();
     if (count($primaryKeys)) {
         $orderBy = 'ORDER BY ' . implode(' ASC, ', $primaryKeys) . ' ASC';
     } else {
         $orderBy = '';
     }
     return "SELECT {$columnList} FROM {$tableMetaData->getTableName()} {$orderBy}";
 }