本文整理汇总了PHP中ActiveRecordModel::isExistingRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecordModel::isExistingRecord方法的具体用法?PHP ActiveRecordModel::isExistingRecord怎么用?PHP ActiveRecordModel::isExistingRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecordModel
的用法示例。
在下文中一共展示了ActiveRecordModel::isExistingRecord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAttribute
/**
* Sets specification attribute value by mapping product, specification field, and
* assigned value to one record (atomic item)
*
* @param iEavSpecification $specification Specification item value
*/
public function setAttribute(iEavSpecification $newSpecification)
{
$specField = $newSpecification->getFieldInstance();
$itemClass = $specField->getSelectValueClass();
if ($this->owner->isExistingRecord() && isset($this->attributes[$newSpecification->getFieldInstance()->getID()]) && ($itemClass == $specField->getSpecificationFieldClass() && $newSpecification->getValue()->isModified())) {
// Delete old value
ActiveRecord::deleteByID($itemClass, $this->attributes[$specField->getID()]->getID());
// And create new
$this->attributes[$specField->getID()] = call_user_func_array(array($itemClass, 'getNewInstance'), array($this->owner, $specField, $newSpecification->getValue()->get()));
} else {
$this->attributes[$specField->getID()] = $newSpecification;
}
unset($this->removedAttributes[$specField->getID()]);
}