public function __construct(EntityTypeInterface $entity_type, $command_class) { parent::__construct($command_class); $this->entity_type = $entity_type; $this->command_state['embedded_entity_type'] = $entity_type->getPrefix(); $this->command_state['embedded_entity_commands'] = new EmbeddedEntityTypeCommandList(); }
/** * Returns the scheme that is used for access of the temporary file/asset storage for * the given aggregate root type. When no type is given the default scheme name * for the common temporary file/asset storage is returned ("tempfiles"). * * @param EntityTypeInterface $entity_type aggregate root type instance * * @return string scheme name, e.g. 'tempfiles' or 'usertempfiles' */ public function getTempScheme(EntityTypeInterface $entity_type = null) { if (null === $entity_type) { return self::SCHEME_TEMPFILES; } return $entity_type->getPrefix() . '.' . self::SCHEME_TEMPFILES; }
protected function getLabelFieldname(EntityTypeInterface $embedded_type) { $type_prefix = $embedded_type->getPrefix(); $label_field_option = $type_prefix . '.label_attribute'; if ($this->hasOption($label_field_option)) { $label_fieldname = $this->getOption($label_field_option); if (!$embedded_type->hasAttribute($label_fieldname)) { throw new RuntimeError(sprintf('Non-existant label_attribute "%s" configured for embed-reference-type: %s', $label_fieldname, $embedded_type->getName())); } return $label_fieldname; } return null; }