本文整理汇总了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();
}
}