protected function generateMorphToColumns($name, Annotation $annotation, EntityDefinition &$entityMetadata)
    {
        $morphName = (! empty($annotation->morphName))
            ? $annotation->morphName
            : $name;

        $morphId = (! empty($annotation->morphId))
            ? $annotation->morphId
            : $morphName.'_id';

        $morphType = (! empty($annotation->morphType))
            ? $annotation->morphType
            : $morphName.'_type';

        $entityMetadata['table']['columns'][] = $this->getModifiedPrimaryKeyColumn($entityMetadata['table'], [
            'name' => $morphId,
            'primary' => false,
            'options' => [
                'autoIncrement' => false
            ]
        ]);

        $entityMetadata['table']['columns'][] = new ColumnDefinition([
            'name' => $morphType,
            'type' => 'string',
            'nullable' => false,
            'default' => false,
            'primary' => false,
            'unique' => false,
            'index' => false,
            'options' => []
        ]);
    }
protected function generateMorphToColumns($name, Annotation $annotation, EntityDefinition &$entityMetadata)
    {
        $morphName = (! empty($annotation->morphName))
            ? $annotation->morphName
            : $name;

        $morphId = (! empty($annotation->morphId))
            ? $annotation->morphId
            : $morphName.'_id';

        $morphType = (! empty($annotation->morphType))
            ? $annotation->morphType
            : $morphName.'_type';

        $entityMetadata['table']['columns'][] = $this->getModifiedPrimaryKeyColumn($entityMetadata['table'], [
            'name' => $morphId,
            'primary' => false,
            'options' => [
                'autoIncrement' => false
            ]
        ]);

        $entityMetadata['table']['columns'][] = new ColumnDefinition([
            'name' => $morphType,
            'type' => 'string',
            'nullable' => false,
            'default' => false,
            'primary' => false,
            'unique' => false,
            'index' => false,
            'options' => []
        ]);
    }
protected function generateMorphToColumns ( $ name , Annotation $ annotation , EntityDefinition & $ entityMetadata ) { $ morphName = ( ! empty ( $ annotation -> morphName ) ) ? $ annotation -> morphName : $ name ; $ morphId = ( ! empty ( $ annotation -> morphId ) ) ? $ annotation -> morphId : $ morphName . '_id' ; $ morphType = ( ! empty ( $ annotation -> morphType ) ) ? $ annotation -> morphType : $ morphName . '_type' ; $ entityMetadata [ 'table' ] [ 'columns' ] [ ] = $ this -> getModifiedPrimaryKeyColumn ( $ entityMetadata [ 'table' ] , [ 'name' => $ morphId , 'primary' => false , 'options' => [ 'autoIncrement' => false ] ] ) ; $ entityMetadata [ 'table' ] [ 'columns' ] [ ] = new ColumnDefinition ( [ 'name' => $ morphType , 'type' => 'string' , 'nullable' => false , 'default' => false , 'primary' => false , 'unique' => false , 'index' => false , 'options' => [ ] ] ) ; }
Generate extra columns for a morphTo relation.

@param array $name
@param \ProAI\Datamapper\Annotations\Annotation $annotation
@param \ProAI\Datamapper\Metadata\Definitions\Class $entityMetadata
@return void
Generate extra columns for a morphTo relation .