protected function PushIntent::embedForFlowAndPool in CMS Content Sync 2.1.x
Same name and namespace in other branches
- 8 src/PushIntent.php \Drupal\cms_content_sync\PushIntent::embedForFlowAndPool()
- 2.0.x src/PushIntent.php \Drupal\cms_content_sync\PushIntent::embedForFlowAndPool()
Push the provided entity along with the processed entity by embedding it right into the current entity. This means the embedded entity can't be used outside of it's parent entity in any way. This is used for field collections right now.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The referenced entity to push as well
null|array $details: {@see SyncIntent::getEmbedEntityDefinition}
\Drupal\cms_content_sync\Entity\Flow $flow:
\Drupal\cms_content_sync\Entity\Pool $pool:
Return value
array|object the definition you can store via {@see SyncIntent::setField} and on the other end receive via {@see SyncIntent::getField}
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Core\Entity\EntityStorageException
\Drupal\cms_content_sync\Exception\SyncException
\GuzzleHttp\Exception\GuzzleException
2 calls to PushIntent::embedForFlowAndPool()
- PushIntent::addReference in src/
PushIntent.php - Push the provided entity as a simple reference. There is no guarantee the referenced entity will be available on the remote site as well, but if it is, it will be de-referenced. If you need the referenced entity to be available, use {
- PushIntent::embed in src/
PushIntent.php - Push the provided entity along with the processed entity by embedding it right into the current entity. This means the embedded entity can't be used outside of it's parent entity in any way. This is used for field collections right now.
File
- src/
PushIntent.php, line 1198
Class
- PushIntent
- Class PushIntent.
Namespace
Drupal\cms_content_syncCode
protected function embedForFlowAndPool($entity, $details, $flow, $pool) {
/**
* @var PushIntent $embed_entity
*/
$embed_entity = PushIntent::pushEntity($entity, PushIntent::PUSH_AS_DEPENDENCY, SyncIntent::ACTION_CREATE, $flow, $pool, true);
if (!$embed_entity) {
throw new SyncException(SyncException::CODE_UNEXPECTED_EXCEPTION, null, 'Failed to embed entity.');
}
$result = $this->operation
->embed($entity
->getEntityTypeId(), $entity
->bundle(), $entity
->uuid(), EntityHandlerPluginManager::isEntityTypeConfiguration($entity
->getEntityType()) ? $entity
->id() : null, Flow::getEntityTypeVersion($entity
->getEntityTypeId(), $entity
->bundle()), $embed_entity
->getOperation(), $details);
$this->embeddedPushIntents[] = $embed_entity;
return $result;
}