diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 140ca2b..0c8ca7a 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -233,6 +233,13 @@ class EntityType implements EntityTypeInterface { protected $constraints = array(); /** + * Any additional properties and values. + * + * @var array + */ + protected $additional = []; + + /** * Constructs a new EntityType. * * @param array $definition @@ -248,10 +255,7 @@ public function __construct($definition) { } foreach ($definition as $property => $value) { - if (!property_exists($this, $property)) { - throw new \InvalidArgumentException(sprintf('"%s" property does not exist on %s. Change the entity annotation for "%s" or extend this class.', $property, get_class($this), $definition['id'])); - } - $this->{$property} = $value; + $this->set($property, $value); } // Ensure defaults. @@ -282,14 +286,25 @@ public function __construct($definition) { * {@inheritdoc} */ public function get($property) { - return isset($this->{$property}) ? $this->{$property} : NULL; + if (property_exists($this, $property)) { + $value = isset($this->{$property}) ? $this->{$property} : NULL; + } + else { + $value = isset($this->additional[$property]) ? $this->additional[$property] : NULL; + } + return $value; } /** * {@inheritdoc} */ public function set($property, $value) { - $this->{$property} = $value; + if (property_exists($this, $property)) { + $this->{$property} = $value; + } + else { + $this->additional[$property] = $value; + } return $this; } diff --git a/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php index 262c21a..7414980 100644 --- a/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -24,7 +24,6 @@ * @ConfigEntityType( * id = "migration", * label = @Translation("Migration"), - * provider = "migrate", * handlers = { * "storage" = "Drupal\migrate\MigrationStorage" * },