/**
* Determines the necessary update actions
*
* @param \eZ\Publish\SPI\Persistence\Content\Type $fromType
* @param \eZ\Publish\SPI\Persistence\Content\Type $toType
*
* @return \eZ\Publish\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action[]
*/
public function determineActions(Type $fromType, Type $toType)
{
$actions = array();
foreach ($fromType->fieldDefinitions as $fieldDef) {
if (!$this->hasFieldDefinition($toType, $fieldDef)) {
$actions[] = new ContentUpdater\Action\RemoveField($this->contentGateway, $fieldDef, $this->storageHandler);
}
}
foreach ($toType->fieldDefinitions as $fieldDef) {
if (!$this->hasFieldDefinition($fromType, $fieldDef)) {
$actions[] = new ContentUpdater\Action\AddField($this->contentGateway, $fieldDef, $this->converterRegistry->getConverter($fieldDef->fieldType), $this->storageHandler);
}
}
return $actions;
}