src/Charcoal/Admin/Script/Object/Table/AlterPrimaryKeyScript.php
public function setRelatedModels($models)
    {
        $models = $this->parseAsArray($models);
        foreach ($models as $i => $model) {
            if (is_string($model)) {
                list($model, $prop) = $this->resolveRelatedModel($model);
                $models[$i]                                 = $model;
                $this->relatedProperties[$model->objType()] = $prop;
            } elseif ($model instanceof ModelInterface) {
                if (!isset($this->relatedProperties[$model->objType()])) {
                    throw new InvalidArgumentException(
                        sprintf(
                            'The related model [%s] requires a target property',
                            get_class($model)
                        )
                    );
                }
                $models[$i] = $model;
            } else {
                throw new InvalidArgumentException(
                    sprintf(
                        'A related model must be defined as "%s"',
                        'ObjType:propertyIdent'
                    )
                );
            }
        }

        $this->relatedModels = $models;

        return $this;
    }
public function setRelatedModels($models)
    {
        $models = $this->parseAsArray($models);
        foreach ($models as $i => $model) {
            if (is_string($model)) {
                list($model, $prop) = $this->resolveRelatedModel($model);
                $models[$i]                                 = $model;
                $this->relatedProperties[$model->objType()] = $prop;
            } elseif ($model instanceof ModelInterface) {
                if (!isset($this->relatedProperties[$model->objType()])) {
                    throw new InvalidArgumentException(
                        sprintf(
                            'The related model [%s] requires a target property',
                            get_class($model)
                        )
                    );
                }
                $models[$i] = $model;
            } else {
                throw new InvalidArgumentException(
                    sprintf(
                        'A related model must be defined as "%s"',
                        'ObjType:propertyIdent'
                    )
                );
            }
        }

        $this->relatedModels = $models;

        return $this;
    }
public function setRelatedModels ( $ models ) { $ models = $ this -> parseAsArray ( $ models ) ; foreach ( $ models as $ i => $ model ) { if ( is_string ( $ model ) ) { list ( $ model , $ prop ) = $ this -> resolveRelatedModel ( $ model ) ; $ models [ $ i ] = $ model ; $ this -> relatedProperties [ $ model -> objType ( ) ] = $ prop ; } elseif ( $ model instanceof ModelInterface ) { if ( ! isset ( $ this -> relatedProperties [ $ model -> objType ( ) ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The related model [%s] requires a target property' , get_class ( $ model ) ) ) ; } $ models [ $ i ] = $ model ; } else { throw new InvalidArgumentException ( sprintf ( 'A related model must be defined as "%s"' , 'ObjType:propertyIdent' ) ) ; } } $ this -> relatedModels = $ models ; return $ this ; }
Set the related models to update.

@param  string|array $models One or more object models.
@throws InvalidArgumentException If the given argument is not a model.
@return self
Set the related models to update .