示例#1
0
 /**
  * Create a new instance of the mapped entity class
  * 
  * @param  array  $attributes 
  * @return mixed
  */
 public function newInstance($attributes = array())
 {
     $class = $this->entityMap->getClass();
     if ($this->entityMap->activator() != null) {
         $entity = $this->entityMap->activator();
     } else {
         $entity = $this->customClassInstance($class);
     }
     // prevent hydrating with an empty array
     if (count($attributes) > 0) {
         $entity->setEntityAttributes($attributes);
     }
     return $entity;
 }