public function prepareDatabaseSave(RelatedField $field)
    {
        if ($this->pk) {
            throw new  ValueError(
                'Unsaved model instance %s '.
                'cannot be used in an ORM query.', $this
            );
        }
        $name = $field->relation->getRelatedField()->getAttrName();

        return $this->{$name};
    }
public function prepareDatabaseSave(RelatedField $field)
    {
        if ($this->pk) {
            throw new  ValueError(
                'Unsaved model instance %s '.
                'cannot be used in an ORM query.', $this
            );
        }
        $name = $field->relation->getRelatedField()->getAttrName();

        return $this->{$name};
    }
public function prepareDatabaseSave ( RelatedField $ field ) { if ( $ this -> pk ) { throw new ValueError ( 'Unsaved model instance %s ' . 'cannot be used in an ORM query.' , $ this ) ; } $ name = $ field -> relation -> getRelatedField ( ) -> getAttrName ( ) ; return $ this -> { $ name } ; }
Used during save.its usually invoked when saving related fields.

@param RelatedField $field

@return mixed

@throws ValueError

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
Used during save . its usually invoked when saving related fields .