本文整理匯總了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;
}