本文整理汇总了PHP中Cake\ORM\Entity::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Entity::__construct方法的具体用法?PHP Entity::__construct怎么用?PHP Entity::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\ORM\Entity
的用法示例。
在下文中一共展示了Entity::__construct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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);
}
示例2: __construct
/**
* 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']);
}
}
示例3: __construct
/**
* 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;
}
}
示例4: __construct
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;
}
}
}
示例5: __construct
/**
* 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);
}