public function getBlameableAttributeRules()
    {
        $rules = [];
        // 创建者和上次修改者由 BlameableBehavior 负责，因此标记为安全。
        if (!is_string($this->createdByAttribute) || empty($this->createdByAttribute)) {
            throw new NotSupportedException('You must assign the creator.');
        }
        if ($this->guidAttribute != $this->createdByAttribute) {
            $rules[] = [
                [$this->createdByAttribute],
                'safe',
            ];
        }

        if (is_string($this->updatedByAttribute) && $this->guidAttribute != $this->updatedByAttribute && !empty($this->updatedByAttribute)) {
            $rules[] = [
                [$this->updatedByAttribute],
                'safe',
            ];
        }

        if ($this->idCreatorCombinatedUnique && is_string($this->idAttribute)) {
            $rules ['id'] = [
                [$this->idAttribute,
                    $this->createdByAttribute],
                'unique',
                'targetAttribute' => [$this->idAttribute,
                    $this->createdByAttribute],
            ];
        }
        return $rules;
    }
public function getBlameableAttributeRules()
    {
        $rules = [];
        // 创建者和上次修改者由 BlameableBehavior 负责，因此标记为安全。
        if (!is_string($this->createdByAttribute) || empty($this->createdByAttribute)) {
            throw new NotSupportedException('You must assign the creator.');
        }
        if ($this->guidAttribute != $this->createdByAttribute) {
            $rules[] = [
                [$this->createdByAttribute],
                'safe',
            ];
        }

        if (is_string($this->updatedByAttribute) && $this->guidAttribute != $this->updatedByAttribute && !empty($this->updatedByAttribute)) {
            $rules[] = [
                [$this->updatedByAttribute],
                'safe',
            ];
        }

        if ($this->idCreatorCombinatedUnique && is_string($this->idAttribute)) {
            $rules ['id'] = [
                [$this->idAttribute,
                    $this->createdByAttribute],
                'unique',
                'targetAttribute' => [$this->idAttribute,
                    $this->createdByAttribute],
            ];
        }
        return $rules;
    }
public function getBlameableAttributeRules ( ) { $ rules = [ ] ; // 创建者和上次修改者由 BlameableBehavior 负责，因此标记为安全。 if ( ! is_string ( $ this -> createdByAttribute ) || empty ( $ this -> createdByAttribute ) ) { throw new NotSupportedException ( 'You must assign the creator.' ) ; } if ( $ this -> guidAttribute != $ this -> createdByAttribute ) { $ rules [ ] = [ [ $ this -> createdByAttribute ] , 'safe' , ] ; } if ( is_string ( $ this -> updatedByAttribute ) && $ this -> guidAttribute != $ this -> updatedByAttribute && ! empty ( $ this -> updatedByAttribute ) ) { $ rules [ ] = [ [ $ this -> updatedByAttribute ] , 'safe' , ] ; } if ( $ this -> idCreatorCombinatedUnique && is_string ( $ this -> idAttribute ) ) { $ rules [ 'id' ] = [ [ $ this -> idAttribute , $ this -> createdByAttribute ] , 'unique' , 'targetAttribute' => [ $ this -> idAttribute , $ this -> createdByAttribute ] , ] ; } return $ rules ; }
Get the rules associated with `createdByAttribute`, `updatedByAttribute`
and `idAttribute`-`createdByAttribute` combination unique.
@return array rules.
@throws NotSupportedException throws if `createdByAttribute` not set.
Get the rules associated with createdByAttribute updatedByAttribute and idAttribute - createdByAttribute combination unique .