FOF30\Model\DataModel::addSkipCheckField PHP Method

addSkipCheckField() public method

Add a field to the list of fields to be ignored by the check() method
public addSkipCheckField ( string $fieldName ) : void
$fieldName string The field to add (can be a field alias)
return void
    public function addSkipCheckField($fieldName)
    {
        if (!is_array($this->fieldsSkipChecks)) {
            $this->fieldsSkipChecks = array();
        }
        if (!$this->hasField($fieldName)) {
            return;
        }
        $fieldName = $this->getFieldAlias($fieldName);
        if (!in_array($fieldName, $this->fieldsSkipChecks)) {
            $this->fieldsSkipChecks[] = $fieldName;
        }
    }

Usage Example

コード例 #1
0
ファイル: Created.php プロジェクト: Joal01/fof
 /**
  * Add the created_on and created_by fields in the fieldsSkipChecks list of the model. We expect them to be empty
  * so that we can fill them in through this behaviour.
  *
  * @param   DataModel  $model
  */
 public function onBeforeCheck(&$model)
 {
     $model->addSkipCheckField('created_on');
     $model->addSkipCheckField('created_by');
 }