private function findAddedFields($modelName, $fieldName)
    {
        $meta = $this->newRegistry->getModel($modelName)->getMeta();
        /** @var $field Field */
        $field = $meta->getField(
            $fieldName
        );
        $opDep = [];

        $preserveDefault = true;

        if (null !== $field->relation && $field->relation->toModel) {
            // depend on related model being created
            $opDep[] = [
                'app' => $field->relation->toModel->getMeta()->getAppName(),
                'target' => $field->relation->toModel->getMeta()->getNSModelName(),
                'type' => self::TYPE_MODEL,
                'action' => self::ACTION_CREATED,
            ];

            $rel = $field->relation;
            // if it has through also depend on through model being created
            if ($field->relation->hasProperty('through') &&
                null != $field->relation->through &&
                !$field->relation->through->getMeta()->autoCreated
            ) {
                $opDep[] = [
                    'app' => $field->relation->through->getMeta()->getAppName(),
                    'target' => $field->relation->through->getMeta()
                        ->getNSModelName(),
                    'type' => self::TYPE_MODEL,
                    'action' => self::ACTION_CREATED,
                ];
            }
        }

        if (!$field->isNull() && !$field->hasDefault() &&
            !$field instanceof ManyToManyField) {
            $def = MigrationQuestion::askNotNullAddition(
                $this->asker,
                $modelName,
                $fieldName,
                $field
            );
            $field = $field->deepClone();
            $field->default = $def;
            $preserveDefault = false;
        }

        $this->addOperation(
            $meta->getAppName(),
            AddField::createObject(
                [
                    'modelName' => $modelName,
                    'name' => $fieldName,
                    'field' => $field,
                    'preserveDefault' => $preserveDefault,
                ]
            ),
            $opDep
        );
    }
private function findAddedFields($modelName, $fieldName)
    {
        $meta = $this->newRegistry->getModel($modelName)->getMeta();
        /** @var $field Field */
        $field = $meta->getField(
            $fieldName
        );
        $opDep = [];

        $preserveDefault = true;

        if (null !== $field->relation && $field->relation->toModel) {
            // depend on related model being created
            $opDep[] = [
                'app' => $field->relation->toModel->getMeta()->getAppName(),
                'target' => $field->relation->toModel->getMeta()->getNSModelName(),
                'type' => self::TYPE_MODEL,
                'action' => self::ACTION_CREATED,
            ];

            $rel = $field->relation;
            // if it has through also depend on through model being created
            if ($field->relation->hasProperty('through') &&
                null != $field->relation->through &&
                !$field->relation->through->getMeta()->autoCreated
            ) {
                $opDep[] = [
                    'app' => $field->relation->through->getMeta()->getAppName(),
                    'target' => $field->relation->through->getMeta()
                        ->getNSModelName(),
                    'type' => self::TYPE_MODEL,
                    'action' => self::ACTION_CREATED,
                ];
            }
        }

        if (!$field->isNull() && !$field->hasDefault() &&
            !$field instanceof ManyToManyField) {
            $def = MigrationQuestion::askNotNullAddition(
                $this->asker,
                $modelName,
                $fieldName,
                $field
            );
            $field = $field->deepClone();
            $field->default = $def;
            $preserveDefault = false;
        }

        $this->addOperation(
            $meta->getAppName(),
            AddField::createObject(
                [
                    'modelName' => $modelName,
                    'name' => $fieldName,
                    'field' => $field,
                    'preserveDefault' => $preserveDefault,
                ]
            ),
            $opDep
        );
    }
private function findAddedFields ( $ modelName , $ fieldName ) { $ meta = $ this -> newRegistry -> getModel ( $ modelName ) -> getMeta ( ) ; /** @var $field Field */ $ field = $ meta -> getField ( $ fieldName ) ; $ opDep = [ ] ; $ preserveDefault = true ; if ( null !== $ field -> relation && $ field -> relation -> toModel ) { // depend on related model being created $ opDep [ ] = [ 'app' => $ field -> relation -> toModel -> getMeta ( ) -> getAppName ( ) , 'target' => $ field -> relation -> toModel -> getMeta ( ) -> getNSModelName ( ) , 'type' => self :: TYPE_MODEL , 'action' => self :: ACTION_CREATED , ] ; $ rel = $ field -> relation ; // if it has through also depend on through model being created if ( $ field -> relation -> hasProperty ( 'through' ) && null != $ field -> relation -> through && ! $ field -> relation -> through -> getMeta ( ) -> autoCreated ) { $ opDep [ ] = [ 'app' => $ field -> relation -> through -> getMeta ( ) -> getAppName ( ) , 'target' => $ field -> relation -> through -> getMeta ( ) -> getNSModelName ( ) , 'type' => self :: TYPE_MODEL , 'action' => self :: ACTION_CREATED , ] ; } } if ( ! $ field -> isNull ( ) && ! $ field -> hasDefault ( ) && ! $ field instanceof ManyToManyField ) { $ def = MigrationQuestion :: askNotNullAddition ( $ this -> asker , $ modelName , $ fieldName , $ field ) ; $ field = $ field -> deepClone ( ) ; $ field -> default = $ def ; $ preserveDefault = false ; } $ this -> addOperation ( $ meta -> getAppName ( ) , AddField :: createObject ( [ 'modelName' => $ modelName , 'name' => $ fieldName , 'field' => $ field , 'preserveDefault' => $ preserveDefault , ] ) , $ opDep ) ; }
Does the actual add of the field.

@param $modelName
@param $fieldName

@throws \Eddmash\PowerOrm\Exception\AppRegistryNotReady
@throws \Eddmash\PowerOrm\Exception\FieldDoesNotExist
@throws \Eddmash\PowerOrm\Exception\KeyError
@throws \Eddmash\PowerOrm\Exception\LookupError
@throws \Eddmash\PowerOrm\Exception\OrmException

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
Does the actual add of the field .