/** * Disallows changing the machine name, during pre-save. * * If the machine name of the bundle was changed, all of the * existing entities with that bundle would be invalid. */ public function preSave(EntityStorageInterface $storage) { parent::preSave($storage); if (!$this->isNew() && $this->getOriginalId() != $this->id()) { throw new ConfigException('Cannot change machine name'); } }
/** * {@inheritdoc} */ public function preSave(EntityStorageInterface $storage_controller, $update = TRUE) { foreach ($this->getPlugins() as $type => $plugin) { $plugin->onFeedTypeSave($update); } foreach ($this->targetPlugins as $delta => $target_plugin) { if ($target_plugin instanceof ConfigurableTargetInterface) { $this->mappings[$delta]['settings'] = $target_plugin->getConfiguration(); } else { unset($this->mappings[$delta]['settings']); } } $this->mappings = array_values($this->mappings); parent::preSave($storage_controller, $update); }
/** * {@inheritdoc} */ public function preSave(EntityStorageInterface $storage) { parent::preSave($storage); $this->getHandlerPlugin()->onQueuePreSave($this, $storage); }
/** * {@inheritdoc} */ public function preSave(EntityStorageInterface $storage) { parent::preSave($storage); $bundles = array_filter($this->get('bundles')); sort($bundles); $this->set('bundles', $bundles); /* // Save the Flag Type configuration. $flagTypePlugin = $this->getFlagTypePlugin(); $this->set('flagTypeConfig', $flagTypePlugin->getConfiguration()); // Save the Link Type configuration. $linkTypePlugin = $this->getLinkTypePlugin(); $this->set('linkTypeConfig', $linkTypePlugin->getConfiguration()); */ // Reset the render cache for the entity. \Drupal::entityTypeManager() ->getViewBuilder($this->getFlaggableEntityTypeId()) ->resetCache(); // Clear entity extra field caches. // @todo Inject the entity field manager into the object? \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); }