private function hydrateDataObject($tableName, array $parentName = array())
    {
        $dataObject = new MetadataDataObjectMySQL(
            new MetaDataColumnCollection(),
            new MetaDataRelationCollection()
        );

        $dataObject->setName($tableName);

        $statement = $this->pdo->prepare(
            "SELECT
                columnTable.column_name, columnTable.table_name,
                columnTable.data_type, columnTable.column_key, columnTable.is_nullable,
                k.referenced_table_name, k.referenced_column_name
            FROM information_schema.columns as columnTable
            left outer join information_schema.key_column_usage k
              on k.table_schema=columnTable.table_schema
              and k.table_name=columnTable.table_name
              and k.column_name=columnTable.column_name
            WHERE columnTable.table_name = :tableName
              AND columnTable.table_schema = :databaseName"
        );

        $statement->execute(
            array(
                ':tableName'    => $tableName,
                ':databaseName' => $this->pdoConfig->getResponse('configDatabaseName'),
            )
        );

        $allFields = $statement->fetchAll(PDO::FETCH_ASSOC);

        $columnsAssociation = array();

        foreach ($allFields as $index => $metadata) {
            if ($metadata['referenced_table_name'] !== null && $metadata['referenced_column_name'] !== null) {
                $columnsAssociation[$index] = $metadata;
                unset($allFields[$index]);
                continue;
            }
        }

        return $this->hydrateRelation(
            $this->hydrateFields($dataObject, $allFields),
            $columnsAssociation,
            $parentName
        );
    }
private function hydrateDataObject($tableName, array $parentName = array())
    {
        $dataObject = new MetadataDataObjectMySQL(
            new MetaDataColumnCollection(),
            new MetaDataRelationCollection()
        );

        $dataObject->setName($tableName);

        $statement = $this->pdo->prepare(
            "SELECT
                columnTable.column_name, columnTable.table_name,
                columnTable.data_type, columnTable.column_key, columnTable.is_nullable,
                k.referenced_table_name, k.referenced_column_name
            FROM information_schema.columns as columnTable
            left outer join information_schema.key_column_usage k
              on k.table_schema=columnTable.table_schema
              and k.table_name=columnTable.table_name
              and k.column_name=columnTable.column_name
            WHERE columnTable.table_name = :tableName
              AND columnTable.table_schema = :databaseName"
        );

        $statement->execute(
            array(
                ':tableName'    => $tableName,
                ':databaseName' => $this->pdoConfig->getResponse('configDatabaseName'),
            )
        );

        $allFields = $statement->fetchAll(PDO::FETCH_ASSOC);

        $columnsAssociation = array();

        foreach ($allFields as $index => $metadata) {
            if ($metadata['referenced_table_name'] !== null && $metadata['referenced_column_name'] !== null) {
                $columnsAssociation[$index] = $metadata;
                unset($allFields[$index]);
                continue;
            }
        }

        return $this->hydrateRelation(
            $this->hydrateFields($dataObject, $allFields),
            $columnsAssociation,
            $parentName
        );
    }
private function hydrateDataObject ( $ tableName , array $ parentName = array ( ) ) { $ dataObject = new MetadataDataObjectMySQL ( new MetaDataColumnCollection ( ) , new MetaDataRelationCollection ( ) ) ; $ dataObject -> setName ( $ tableName ) ; $ statement = $ this -> pdo -> prepare ( "SELECT
                columnTable.column_name, columnTable.table_name,
                columnTable.data_type, columnTable.column_key, columnTable.is_nullable,
                k.referenced_table_name, k.referenced_column_name
            FROM information_schema.columns as columnTable
            left outer join information_schema.key_column_usage k
              on k.table_schema=columnTable.table_schema
              and k.table_name=columnTable.table_name
              and k.column_name=columnTable.column_name
            WHERE columnTable.table_name = :tableName
              AND columnTable.table_schema = :databaseName" ) ; $ statement -> execute ( array ( ':tableName' => $ tableName , ':databaseName' => $ this -> pdoConfig -> getResponse ( 'configDatabaseName' ) , ) ) ; $ allFields = $ statement -> fetchAll ( PDO :: FETCH_ASSOC ) ; $ columnsAssociation = array ( ) ; foreach ( $ allFields as $ index => $ metadata ) { if ( $ metadata [ 'referenced_table_name' ] !== null && $ metadata [ 'referenced_column_name' ] !== null ) { $ columnsAssociation [ $ index ] = $ metadata ; unset ( $ allFields [ $ index ] ) ; continue ; } } return $ this -> hydrateRelation ( $ this -> hydrateFields ( $ dataObject , $ allFields ) , $ columnsAssociation , $ parentName ) ; }
Convert MySQL mapping to CodeGenerator mapping
@param  string                  $tableName
@return MetadataDataObjectMySQL
Convert MySQL mapping to CodeGenerator mapping