Commit 45a4e02c authored by tanc's avatar tanc Committed by Ra Mänd
Browse files

Issue #2833061 by tangozulu, coreykck, tanc: Exception: The host entity cannot...

Issue #2833061 by tangozulu, coreykck, tanc: Exception: The host entity cannot be changed. in FieldCollectionItemEntity->updateHostEntity()
parent 25b5cee3
......@@ -234,7 +234,15 @@ class FieldCollectionItemEntity extends Entity {
list($recieved_id) = entity_extract_ids($this->hostEntityType, $entity);
if ($this->isInUse() && !empty($this->hostEntityId)) {
$current_id = $this->hostEntityId;
if (is_array($this->hostEntityId)) {
$current_id = in_array(
$recieved_id,
$this->hostEntityId
) ? $recieved_id : FALSE;
}
else {
$current_id = $this->hostEntityId;
}
}
else {
$current_host = entity_revision_load($this->hostEntityType, $this->hostEntityRevisionId);
......@@ -334,7 +342,7 @@ class FieldCollectionItemEntity extends Entity {
if ($this->isInUse()) {
$data_array_keys = array_keys($data);
$this->hostEntityId = $data ? end($data_array_keys) : FALSE;
$this->hostEntityId = $data ? $data_array_keys : FALSE;
$this->hostEntityRevisionId = FALSE;
}
// If we are querying for revisions, we get the revision ID.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment