Doctrine\ORM\Tools\SchemaTool::_gatherColumns PHP Method

_gatherColumns() private method

Gathers the column definitions as required by the DBAL of all field mappings found in the given class.
private _gatherColumns ( Doctrine\ORM\Mapping\ClassMetadata $class, Table $table ) : array
$class Doctrine\ORM\Mapping\ClassMetadata
$table Table
return array The list of portable column definitions as required by the DBAL.
    private function _gatherColumns($class, $table)
    {
        $columns = array();
        $pkColumns = array();

        foreach ($class->fieldMappings as $fieldName => $mapping) {
            $column = $this->_gatherColumn($class, $mapping, $table);

            if ($class->isIdentifier($mapping['fieldName'])) {
                $pkColumns[] = $class->getQuotedColumnName($mapping['fieldName'], $this->_platform);
            }
        }
        // For now, this is a hack required for single table inheritence, since this method is called
        // twice by single table inheritence relations
        if(!$table->hasIndex('primary')) {
            $table->setPrimaryKey($pkColumns);
        }

        return $columns;
    }