Commit c2bcc9ec authored by ilyin.eugenegmail.com's avatar ilyin.eugenegmail.com Committed by Joel Muzzerall
Browse files

Issue #2619550 by eugene.ilyin, rvillan, DamienMcKenna, Marc DeLay: Notice:...

Issue #2619550 by eugene.ilyin, rvillan, DamienMcKenna, Marc DeLay: Notice: Undefined index: entity keys in entity_extract_ids()
parent bc01bdb3
......@@ -215,9 +215,20 @@ class FieldCollectionItemEntity extends Entity {
*
* @param object $entity
* Host entity.
* @param string $host_entity_type
* The entity type of the entity the field collection is attached to.
*/
public function updateHostEntity($entity) {
public function updateHostEntity($entity, $host_entity_type = NULL) {
$this->fetchHostDetails();
// If it isn't possible to retrieve hostEntityType due to the fact that it's
// not saved in the DB yet then fill in info about the hostEntity manually.
// This happens when creating a new revision of a field collection entity
// and it needs to relate to the new revision of the host entity.
if (!$this->hostEntityType) {
$this->hostEntityType = $host_entity_type;
$this->hostEntity = $entity;
list($this->hostEntityId, $this->hostEntityRevisionId) = entity_extract_ids($this->hostEntityType, $this->hostEntity);
}
list($recieved_id) = entity_extract_ids($this->hostEntityType, $entity);
if ($this->isInUse()) {
......
......@@ -541,7 +541,7 @@ function field_collection_field_update($host_entity_type, $host_entity, $field,
$entity->setHostEntity($host_entity_type, $host_entity, $langcode, FALSE);
}
else {
$entity->updateHostEntity($host_entity);
$entity->updateHostEntity($host_entity, $host_entity_type);
}
$entity->save(TRUE);
......
Supports Markdown
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