本文整理匯總了PHP中Gpf_DbEngine_Row::getPrimaryColumns方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gpf_DbEngine_Row::getPrimaryColumns方法的具體用法?PHP Gpf_DbEngine_Row::getPrimaryColumns怎麽用?PHP Gpf_DbEngine_Row::getPrimaryColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gpf_DbEngine_Row
的用法示例。
在下文中一共展示了Gpf_DbEngine_Row::getPrimaryColumns方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doOneRowLoaded
/**
* @throws Gpf_Exception
*/
protected function doOneRowLoaded(Gpf_DbEngine_Row $row, $tempRow)
{
$primaryColumns = $row->getPrimaryColumns();
foreach ($primaryColumns as $column) {
if ($tempRow->get($column->getName()) != $row->get($column->getName())) {
$this->throwException();
}
}
}
示例2: __construct
public function __construct(array $columnMapping, Gpf_DbEngine_Row $parentRow, $mandatoryParent = true, $message = null)
{
foreach ($parentRow->getPrimaryColumns() as $column) {
if (!in_array($column->getName(), $columnMapping)) {
throw new Gpf_Exception("Column %s is not part of primary key", $column->getName());
}
}
$this->columnMapping = $columnMapping;
$this->parentRow = $parentRow;
$this->mandatoryParent = $mandatoryParent;
if ($message != null) {
$this->message = $message;
} else {
$this->message = $this->_("Relation constraint");
}
}
示例3: validate
/**
* Validate Db_Row
*
* @param Gpf_DbEngine_Row $row
* @throws Gpf_DbEngine_Row_ConstraintException
*/
public function validate(Gpf_DbEngine_Row $row)
{
$select = new Gpf_SqlBuilder_SelectBuilder();
$select->select->add('COUNT(*)', 'cnt');
$select->from->add($row->getTable()->name());
foreach ($row->getPrimaryColumns() as $primaryColumn) {
$select->where->add($primaryColumn->getName(), '<>', $row->get($primaryColumn->getName()));
}
$conditionNotEqalColumns = new Gpf_SqlBuilder_CompoundWhereCondition();
foreach ($this->columnsNotEqualNames as $columnNotEqualName) {
$conditionNotEqalColumns->add($columnNotEqualName, '=', $row->get($this->columnName), 'OR');
}
$select->where->addCondition($conditionNotEqalColumns);
$select->limit->set(0, 1);
if ($select->getOneRow()->get('cnt') > 0) {
$this->throwException();
}
}