EntityAdapter example

foreach ($constraints['Bundle']->getBundleOption() as $bundle) {
          // We have a bundle, we are bundleable and we can generate a sample.           $values = [$entity_type->getKey('bundle') => $bundle];
          yield EntityAdapter::createFromEntity($storage->create($values));
        }
        return;
      }
    }

    // Either no bundle, or not bundleable, so generate an entity adapter.     $definition = EntityDataDefinition::create($entity_type_id);
    yield new EntityAdapter($definition);
  }

  /** * Creates a context definition from a given entity type ID. * * @param string $entity_type_id * The entity type ID from which to derive a context definition. * * @return static */
  public static function fromEntityTypeId($entity_type_id) {
    
Home | Imprint | This part of the site doesn't use cookies.