/**
  * construtor
  *
  * @param ConfigAbstract $config
  * */
 public function __construct(ConfigAbstract $config)
 {
     $this->_config = $config;
     # inicia o setup das configurações de ambiente
     $this->setupEnvironment($this->_config);
     # registra o bootstrap na registry
     Registry::set('bootstrap', $this);
     # setup default module/functionaly/action
     $tmpCfgApp = $this->_config->get('app');
     # setup persistcofig
     PersistConfig::registerConfigs($tmpCfgApp->get('persist')->toArray());
     $moduleDefault = $tmpCfgApp->get('module.default');
     Request::$moduleDefault = $moduleDefault->get('name');
     Request::$functionalityDefault = $moduleDefault->get('functionality');
     Request::$actionDefault = $moduleDefault->get('action');
     /* recupera */
     $this->_request = new Request();
     /* aponta para o config.ini do módulo selecionado, caso este possui um .ini próprio */
     $this->_useEspecificConfigIniFileIfExistsOne();
     # registra o local de armazenamento do cache dos Values Object
     AnnotationCache::$cacheDir = $tmpCfgApp->get('cache.home');
     # inicializa a requisicao
     $this->_request->setBehaviorMagicQuotesGPC($config->get('php.environment.magic_quotes_gpc'));
     # inicializa o manipulador de constantes
     $this->_constantHandler = ConstantHandler::factory($this);
     $this->_autoloadConstant();
     # habilita ou nao uso de registro de log
     $this->_enablePersistLog($this->_config);
 }
Example #2
0
 /**
  * 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);
     }
 }