protected function FieldCollectionItem::deleteHostEntityReference in Field collection 8.3
Same name and namespace in other branches
- 8 src/Entity/FieldCollectionItem.php \Drupal\field_collection\Entity\FieldCollectionItem::deleteHostEntityReference()
Deletes the host entity's reference of the field collection item.
1 call to FieldCollectionItem::deleteHostEntityReference()
- FieldCollectionItem::delete in src/
Entity/ FieldCollectionItem.php - Deletes an entity permanently.
File
- src/
Entity/ FieldCollectionItem.php, line 212
Class
- FieldCollectionItem
- Defines the field collection item entity class.
Namespace
Drupal\field_collection\EntityCode
protected function deleteHostEntityReference() {
$delta = $this
->getDelta();
if ($this
->id() && isset($delta) && NULL !== $this
->getHost() && isset($this
->getHost()->{$this
->bundle()}[$delta])) {
$host = $this
->getHost();
unset($host->{$this
->bundle()}[$delta]);
// Do not save when the host entity is being deleted. See
// \Drupal\field_collection\Plugin\Field\FieldType\FieldCollection::delete().
if (empty($this->field_collection_deleting)) {
$host
->save();
}
}
}