$targetModel
$targetModel : \Charcoal\Model\ModelInterface|null
The model to alter.
Alter an object's primary key (SQL source).
run(\Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response) : \Psr\Http\Message\ResponseInterface
Run the script.
\Psr\Http\Message\RequestInterface | $request | A PSR-7 compatible Request instance. |
\Psr\Http\Message\ResponseInterface | $response | A PSR-7 compatible Response instance. |
setModelFactory(\Charcoal\Factory\FactoryInterface $factory) : \Charcoal\Admin\AdminScript
\Charcoal\Factory\FactoryInterface | $factory | The factory used to create models. |
Chainable
prepareProperties(string $oldKey, string $newKey, \Charcoal\Property\IdProperty|null $oldProp = null, \Charcoal\Property\IdProperty|null $newProp = null) : array<mixed,\Charcoal\Property\IdProperty>
Retrieve the old and new ID properties.
string | $oldKey | The previous key. |
string | $newKey | The new key. |
\Charcoal\Property\IdProperty|null | $oldProp | If provided, then it is filled with an instance of IdProperty. |
\Charcoal\Property\IdProperty|null | $newProp | If provided, then it is filled with an instance of IdProperty. |
convertIdField(\Charcoal\Property\IdProperty $newProp, \Charcoal\Property\PropertyField $newField, \Charcoal\Property\IdProperty $oldProp, \Charcoal\Property\PropertyField $oldField) : self
Convert a primary key column from one format to another.
\Charcoal\Property\IdProperty | $newProp | The new ID property. |
\Charcoal\Property\PropertyField | $newField | The new ID field. |
\Charcoal\Property\IdProperty | $oldProp | The previous ID property. |
\Charcoal\Property\PropertyField | $oldField | The previous ID field. |
If the new property does not implement the proper mode.
syncRelatedFields(\Charcoal\Property\IdProperty $newProp, \Charcoal\Property\PropertyField $newField, \Charcoal\Property\IdProperty $oldProp, \Charcoal\Property\PropertyField $oldField) : self
Sync the new primary keys to related models.
\Charcoal\Property\IdProperty | $newProp | The new ID property. |
\Charcoal\Property\PropertyField | $newField | The new ID field. |
\Charcoal\Property\IdProperty | $oldProp | The previous ID property. |
\Charcoal\Property\PropertyField | $oldField | The previous ID field. |
If the new property does not implement the proper mode.
resolveRelatedModel(string $pattern) : array
Resolve the given related model.
string | $pattern | A 'model:property' identifier. |
If the identifier is invalid.
Returns an array containing a ModelInterface and a property identifier.
booleanInput(\Charcoal\Property\PropertyInterface $prop) : \League\CLImate\TerminalObject\Dynamic\Input
Get a CLI input from a boolean property.
\Charcoal\Property\PropertyInterface | $prop | The property to retrieve input from. |
passwordInput(\Charcoal\Property\PropertyInterface $prop) : \League\CLImate\TerminalObject\Dynamic\Input
Get a CLI password input (hidden) from a password property.
\Charcoal\Property\PropertyInterface | $prop | The property to retrieve input from. |
dropPrimaryKey(\Charcoal\Property\PropertyField $field, \Charcoal\Property\IdProperty $prop) : self
Drop the primary key from the given field.
\Charcoal\Property\PropertyField | $field | The previous ID field. |
\Charcoal\Property\IdProperty | $prop | The previous ID property. |