/** * Merge any Value Object's attribute with entity's attribute * * @param array * @return array */ protected function flattenEmbeddables(array $attributes) { $embeddables = $this->entityMap->getEmbeddables(); foreach ($embeddables as $localKey => $embed) { $valueObject = $attributes[$localKey]; unset($attributes[$localKey]); $attributes = array_merge($attributes, $valueObject->getEntityAttributes()); } return $attributes; }
/** * Hydrate value object embedded in this entity * * @param array $attributes * @return void */ protected function hydrateValueObjects(&$attributes) { foreach ($this->entityMap->getEmbeddables() as $localKey => $valueClass) { $this->hydrateValueObject($attributes, $localKey, $valueClass); } }