本文整理汇总了PHP中xPDOSimpleObject::set方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOSimpleObject::set方法的具体用法?PHP xPDOSimpleObject::set怎么用?PHP xPDOSimpleObject::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDOSimpleObject
的用法示例。
在下文中一共展示了xPDOSimpleObject::set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* Make sure we clean up names
*/
public function set($k, $v = null, $vType = '')
{
if ($k == 'name') {
$v = strip_tags(trim(preg_replace('/\\s+/', ' ', $v)));
}
return parent::set($k, $v, $vType);
}
示例2: set
/**
* Set a field value by the field key or name.
*
* {@inheritdoc}
*
* Additional logic added for the following fields:
* -alias: Applies {@link modResource::cleanAlias()}
* -contentType: Calls {@link modResource::addOne()} to sync contentType
* -content_type: Sets the contentType field appropriately
*/
public function set($k, $v = null, $vType = '')
{
switch ($k) {
case 'alias':
$v = $this->cleanAlias($v);
break;
}
return parent::set($k, $v, $vType);
}
示例3: set
function set($k, $v = null, $vType = '')
{
switch ($k) {
// Protect changing class_key
case 'class_key':
$v = $this->get($k);
break;
}
return parent::set($k, $v, $vType);
}
示例4: set
/**
* Override set to trim string fields
*
* {@inheritDoc}
*/
public function set($k, $v = null, $vType = '')
{
switch ($k) {
case 'name':
case 'description':
if (is_string($v)) {
$v = trim($v);
}
break;
}
return parent::set($k, $v, $vType);
}
示例5: set
/**
* Overrides xPDOObject::set to provide custom functionality and automation
* for the closure tables that persist the board map.
*
* @param string $k
* @param mixed $v
* @param string $vType
* @return boolean
*/
public function set($k, $v = null, $vType = '')
{
$oldParentId = $this->get('parent');
$oldCategory = $this->get('category');
$set = parent::set($k, $v, $vType);
if ($set && $k == 'parent' && $v != $oldParentId && !$this->isNew()) {
$this->parentChanged = true;
} else {
if ($set && $k == 'category' && $v != $oldCategory && !$this->isNew()) {
$this->categoryChanged = true;
$this->xpdo->log(modX::LOG_LEVEL_ERROR, print_r($this->get('category'), true));
}
}
return $set;
}