/** * Construtor. * * @override * <ul> * <li>Entity::__construct(string $namespace, string[] $column)</li> * <li>Entity::__construct(ValueObject $valueObject, string[] $column)</li> * <li>Entity::__construct(array(string $alias => string $namespace), strin[] $column)</li> * <li>Entity::__construct(array(string $alias => ValueObject $valueObject), string[] $column)</li> * </ul> * * @param mixed $entity * @param string[]|Column[] $columns * @param string $persistType * @throws ValueObjectException * */ public function __construct($entity, array $columns = array(), $persistType = NULL) { $type = gettype($entity); $this->_persistType = $persistType; if ('array' == $type) { $this->_alias = key($entity); $entity = current($entity); $type = gettype($entity); } if ('string' == $type) { $this->_setup(AnnotationCache::load($entity), $columns); } if ($entity instanceof ValueObjectAbstract) { $this->_setup($entity->annotation()->load(), $columns); } }