示例#1
0
 /**
  * Get a combo type.primaryKey
  *
  * @param  Mappable $entity
  * @return string
  */
 protected function getEntityHash(Mappable $entity)
 {
     $class = get_class($entity);
     $keyName = $this->relatedMapper->getManager()->mapper($class)->getEntityMap()->getKeyName();
     $hash = $class . '.' . $entity->getEntityAttribute($keyName);
     return $hash;
 }
示例#2
0
 /**
  * Hydrate a single value object
  *
  * @param  array $attributes
  * @param  string $localKey
  * @param  string $valueClass
  * @return void
  */
 protected function hydrateValueObject(&$attributes, $localKey, $valueClass)
 {
     $map = $this->mapper->getManager()->getValueMap($valueClass);
     $embeddedAttributes = $map->getAttributes();
     //$nestedValueObjects = $map->getEmbeddables();
     $valueObject = $this->mapper->getManager()->getValueObjectInstance($valueClass);
     foreach ($embeddedAttributes as $key) {
         $prefix = snake_case(class_basename($valueClass)) . '_';
         $valueObject->setEntityAttribute($key, $attributes[$prefix . $key]);
         unset($attributes[$prefix . $key]);
     }
     $attributes[$localKey] = $valueObject;
 }