2017 © Pedro Peláez
 

library yii-old-attribute-behavior

Yii old attribute behavior.

image

intersvyaz/yii-old-attribute-behavior

Yii old attribute behavior.

  • Wednesday, March 25, 2015
  • by intersvyaz-it
  • Repository
  • 10 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

yii-old-attribute-behavior

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Example usage:, (*2)

class User extends CActiveRecord
{
  /**
   * @inheritdoc
   */
    public function behaviors()
    {
        return array_merge(
            parent::behaviors(),
            [
                'oldBehavior' => ['class' => Intersvyaz\Behavior\OldAttributesBehavior::class],
            ]
        );
    }

    /**
     * @inheritdoc
     */
    protected function afterSave()
    {
      if ($this->isModified('username')) {
          // some your logic
          $oldValue = $this->old->username;
          // or
          $oldValue = $this->oldAttributes['username'];
          // new value in $this->username
      }
      parent::afterSave();
    }
}

The Versions

25/03 2015

dev-master

9999999-dev

Yii old attribute behavior.

  Sources   Download

MIT

The Requires

 

by Avatar kikimor
by rustik
by gureedo

23/03 2015

v1.0.0

1.0.0.0

Yii old attribute behavior.

  Sources   Download

MIT

The Requires

 

by Avatar kikimor