Ejemplo n.º 1
0
 /**
  * Entity constructor.
  *
  * @param array $properties
  * @param array $options
  */
 public function __construct(array $properties = [], array $options = [])
 {
     if (isset($properties['params']) && is_string($properties['params'])) {
         $properties['params'] = json_decode($properties['params'], true);
     }
     parent::__construct($properties, $options);
 }
 /**
  * Constructor
  *
  * @param array $properties hash of properties to set in this entity
  * @param array $options list of options to use when creating this entity
  */
 public function __construct(array $properties = [], array $options = [])
 {
     $options += ['pathBuilder' => $this->_pathBuilderClass, 'pathBuilderOptions' => $this->_pathBuilderOptions];
     parent::__construct($properties, $options);
     if (!empty($options['pathBuilder'])) {
         $this->pathBuilder($options['pathBuilder'], $options['pathBuilderOptions']);
     }
 }
Ejemplo n.º 3
0
 /**
  *  Preliminary check for alternate/tmp file must be made 
  */
 public function __construct(array $properties, array $options)
 {
     parent::__construct($properties, $options);
     Configure::load('UploadManager.images', 'default');
     $this->tmpDirPath = Configure::read('Images.tmpStoragePath');
     $this->tmpDirFull = WWW_ROOT . $this->tmpDirPath;
     $tmpPath = $this->tmpDirPath . DS . $this->source() . '-' . $this->_properties['id'];
     $tmpPathFull = WWW_ROOT . $tmpPath;
     $tmp = new File($tmpPathFull);
     if ($tmp->exists()) {
         $this->tmpPath = $tmpPath;
         $this->tmpPathFull = $tmpPathFull;
     }
 }
Ejemplo n.º 4
0
 public function __construct($properties = [], $options = [])
 {
     parent::__construct($properties, $options);
     if ($this->isNew()) {
         $this->set($this->_defaults, ['guard' => false]);
     }
     foreach ($this->_editAuth as $p => $access) {
         if (is_bool($access)) {
             $this->accessible($p, $access);
             continue;
         }
         if (!is_array($access)) {
             $access = [$access];
         }
         $this->accessible($p, false);
         foreach ($access as $auth) {
             if (AuthState::hasRole($auth)) {
                 $this->accessible($p, true);
                 break;
             }
         }
     }
     foreach ($this->_showAuth as $p => $access) {
         if (!is_array($access)) {
             $access = [$access];
         }
         $show = false;
         foreach ($access as $auth) {
             if (AuthState::hasRole($auth)) {
                 $show = true;
                 break;
             }
         }
         if (!$show) {
             $this->_hidden[] = $p;
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Token constructor.
  *
  * @param array $properties
  * @param array $options
  */
 public function __construct(array $properties = [], array $options = [])
 {
     $lifetime = Configure::read('Muffin/Tokenize.lifetime') ?: self::DEFAULT_LIFETIME;
     $properties += ['token' => self::random(), 'status' => false, 'expired' => date('Y-m-d H:i:s', strtotime($lifetime))];
     parent::__construct($properties, $options);
 }