当前位置: 首页>>代码示例>>PHP>>正文


PHP Gpf_DbEngine_Row类代码示例

本文整理汇总了PHP中Gpf_DbEngine_Row的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_DbEngine_Row类的具体用法?PHP Gpf_DbEngine_Row怎么用?PHP Gpf_DbEngine_Row使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Gpf_DbEngine_Row类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 /**
  * Validate Db_Row
  *
  * @param Gpf_DbEngine_Row $row
  * @throws Gpf_DbEngine_Row_ConstraintException
  */
 public function validate(Gpf_DbEngine_Row $row)
 {
     $template = new Gpf_Templates_Template($row->get($this->columnName), '', Gpf_Templates_Template::FETCH_TEXT);
     if (!$template->isValid()) {
         $this->throwException();
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:13,代码来源:SmartyConstraint.class.php

示例2: execute

 public function execute(Gpf_DbEngine_Row $dbRow)
 {
     if (!$this->isLastUserWithAuthID($dbRow->get(Gpf_Db_Table_Users::AUTHID))) {
         return;
     }
     parent::execute($dbRow);
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:7,代码来源:Users.class.php

示例3: validate

 /**
  * Validate Db_Row
  *
  * @param Gpf_DbEngine_Row $row
  * @throws Gpf_DbEngine_Row_ConstraintException
  */
 public function validate(Gpf_DbEngine_Row $row)
 {
     if ($row->get(Pap_Db_Table_Users::TYPE) != Pap_Application::ROLETYPE_AFFILIATE) {
         return;
     }
     return parent::validate($row);
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:13,代码来源:RefIdLengthConstraint.class.php

示例4: validateRefid

 protected function validateRefid(Gpf_DbEngine_Row $row) {
     if ($row->get(Pap_Db_Table_Users::TYPE) == Pap_Application::ROLETYPE_AFFILIATE &&
     !$this->codeValidator->validate($row->get(Pap_Db_Table_Users::REFID))) {
         throw new Gpf_DbEngine_Row_ConstraintException(Pap_Db_Table_Users::REFID,
         $this->_('Refid must be in format "%s". Format definition: {9} - will be replaced by any character in range [0-9], {z} - will be replaced by any character in range [a-z], {Z} - will be replaced by any character in range [A-Z], {X} - will be replaced by any character in range [0-9a-zA-Z], all other characters will be unchanged. Example of good format is e.g. {ZZZ}-{XXXXX}-{999}',
         Gpf_Settings::get(CustomRefid_Config::CUSTOM_REFID_FORMAT)));
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:8,代码来源:CustomRefidConstraint.class.php

示例5: 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();
         }
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:12,代码来源:UniqueConstraint.class.php

示例6: validate

 /**
  * Validate Db_Row
  *
  * @param Gpf_DbEngine_Row $row
  * @throws Gpf_DbEngine_Row_ConstraintException
  */
 public function validate(Gpf_DbEngine_Row $row)
 {
     $value = $row->get($this->columnName);
     if ($value === null || $value == '') {
         return;
     }
     if (!is_numeric($value)) {
         throw new Gpf_DbEngine_Row_ConstraintException($this->columnName, $this->_("Column %s must be number (%s given)", $this->columnName, $value));
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:16,代码来源:NumberConstraint.class.php

示例7: execute

 public function execute(Gpf_DbEngine_Row $dbRow)
 {
     $updateBuilder = new Gpf_SqlBuilder_UpdateBuilder();
     $updateBuilder->from->add($this->foreignDbRow->getTable()->name());
     for ($i = 0; $i < count($this->selfColumns); $i++) {
         $updateBuilder->set->add($this->foreignColumns[$i], 'NULL', false);
         $updateBuilder->where->add($this->foreignColumns[$i], "=", $dbRow->get($this->selfColumns[$i]));
     }
     $updateBuilder->execute();
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:10,代码来源:SetNullDeleteConstraint.class.php

示例8: execute

 public function execute(Gpf_DbEngine_Row $dbRow)
 {
     for ($i = 0; $i < count($this->selfColumns); $i++) {
         $this->foreignDbRow->set($this->foreignColumns[$i], $dbRow->get($this->selfColumns[$i]));
     }
     $rowCollection = $this->foreignDbRow->loadCollection($this->foreignColumns);
     if ($rowCollection->getSize() > 0) {
         throw new Gpf_DbEngine_RestrictDeleteException($dbRow);
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:10,代码来源:RestrictDeleteConstraint.class.php

示例9: isAddingExactlyOneRow

 private function isAddingExactlyOneRow(Gpf_DbEngine_Row $row)
 {
     foreach ($this->uniqueColumnNames as $columnName => $value) {
         if ($value === false) {
             continue;
         }
         if ($row->get($columnName) != $value) {
             return false;
         }
     }
     return true;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:12,代码来源:ExactlyOneConstraint.class.php

示例10: loadRow

 protected function loadRow(Gpf_DbEngine_Row $row) {
     $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
     $selectBuilder->from->add($row->getTable()->name());
     $selectBuilder->select->addAll($row->getTable());
     foreach ($this->uniqueColumnNames as $columnName=>$value) {
         if ($value === false) {
             $selectBuilder->where->add($columnName,'=',$row->get($columnName));
             continue;
         }
         $selectBuilder->where->add($columnName,'=',$value);
     }
     return $selectBuilder->getOneRow();
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:13,代码来源:ZeroOrOneDefaultCampaignConstraint.class.php

示例11: validate

 /**
  * Validate Db_Row
  *
  * @param Gpf_DbEngine_Row $row
  * @throws Gpf_DbEngine_Row_ConstraintException
  */
 public function validate(Gpf_DbEngine_Row $row)
 {
     $value = $row->get($this->columnName);
     if ($value == null || $value == "") {
         return;
     }
     if (preg_match($this->regExp, $value) != 1) {
         if ($this->message == "") {
             throw new Gpf_DbEngine_Row_ConstraintException($this->columnName, $this->_("Column %s contains unallowed characters", $this->columnName));
         }
         throw new Gpf_DbEngine_Row_ConstraintException($this->columnName, Gpf_Lang::_replaceArgs($this->message, $value));
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:19,代码来源:RegExpConstraint.class.php

示例12: validate

 /**
  * Validate Db_Row
  *
  * @param Gpf_DbEngine_Row $row
  * @throws Gpf_DbEngine_Row_ConstraintException
  */
 public function validate(Gpf_DbEngine_Row $row)
 {
     foreach ($this->columnMapping as $column => $parentColumn) {
         $this->parentRow->set($parentColumn, $row->get($column));
     }
     if ($this->parentRow->isPrimaryKeyEmpty() && !$this->mandatoryParent) {
         return;
     }
     try {
         $this->parentRow->load();
     } catch (Gpf_Exception $e) {
         //TODO: create new Exception class
         throw new Gpf_DbEngine_Row_ConstraintException('', $this->message);
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:21,代码来源:RelationConstraint.class.php

示例13: 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();
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:24,代码来源:ColumnsNotEqualConstraint.class.php

示例14: execute

 public function execute(Gpf_DbEngine_Row $dbRow)
 {
     if (count($this->foreignDbRow->getTable()->getDeleteConstraints()) == 0) {
         $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
         $deleteBuilder->from->add($this->foreignDbRow->getTable()->name());
         for ($i = 0; $i < count($this->selfColumns); $i++) {
             $deleteBuilder->where->add($this->foreignColumns[$i], "=", $dbRow->get($this->selfColumns[$i]));
         }
         $deleteBuilder->execute();
         return;
     }
     for ($i = 0; $i < count($this->selfColumns); $i++) {
         $this->foreignDbRow->set($this->foreignColumns[$i], $dbRow->get($this->selfColumns[$i]));
     }
     $rowCollection = $this->foreignDbRow->loadCollection($this->foreignColumns);
     foreach ($rowCollection as $row) {
         $row->delete();
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:19,代码来源:CascadeDeleteConstraint.class.php

示例15: validate

 /**
  * Validate Db_Row
  *
  * @param Gpf_DbEngine_Row $row
  * @throws Gpf_DbEngine_Row_ConstraintException
  */
 public function validate(Gpf_DbEngine_Row $row)
 {
     if ($this->minLength == 0 && $this->maxLength == 0) {
         return;
     }
     if ($this->minLength > 0 && strlen($row->get($this->columnName)) < $this->minLength) {
         if ($this->minMessage == '') {
             throw new Gpf_DbEngine_Row_ConstraintException($this->columnName, $this->_('Minimum length of %s in %s is %s', $this->columnName, get_class($row), $this->minLength - 1));
         } else {
             throw new Gpf_DbEngine_Row_ConstraintException($this->columnName, Gpf_Lang::_replaceArgs($this->minMessage, $this->minLength - 1));
         }
     }
     if ($this->maxLength > 0 && strlen($row->get($this->columnName)) > $this->maxLength) {
         if ($this->maxMessage == '') {
             throw new Gpf_DbEngine_Row_ConstraintException($this->columnName, $this->_('Maximum length of %s in %s is %s', $this->columnName, get_class($row), $this->maxLength));
         } else {
             throw new Gpf_DbEngine_Row_ConstraintException($this->columnName, Gpf_Lang::_replaceArgs($this->maxMessage, $this->maxLength));
         }
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:26,代码来源:LengthConstraint.class.php


注:本文中的Gpf_DbEngine_Row类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。