2017 © Pedro Peláez
 

extension itchanged

extension for yii1

image

one-art/itchanged

extension for yii1

  • Tuesday, September 23, 2014
  • by One-art
  • Repository
  • 2 Watchers
  • 2 Stars
  • 88 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

#ItChanged - Extension for Yii 1

This extension help to save model state before updating and check which attribute has been changed., (*1)

For example, you want to check if user name changed or not and after update some cache and etc., (*2)

public function beforeSave() {
    if($this->itChanged('username'))
        echo 'changed';
    else
        echo 'not changed';
}

You also can see how it changed. Use method $this->getModelState() This method return associative array: [ %attribute_name% => %attribute_value%, ... ], (*3)

Installation

I recommended use trait. (only for PHP >= 5.4.0) For example:, (*4)

class User extends CActiveRecord {
    use ItChangedExtension\ItChangedTrait;
}

Simple, after use your class extending functional from trait., (*5)

But extension support old way to use throw extend. If you have model which extend CActiveRecord, you just change extend to ItChangedActiveRecord class Same with CForm and CModel, (*6)

For import files if you not use composer, just add include_once in your index.php before yii set up., (*7)

Install from composer

{
 "require": {
    "one-art/itchanged": "*"
 }
}

The Versions

23/09 2014

1.0.x-dev

1.0.9999999.9999999-dev

extension for yii1

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

  • php >=5.3.0

by oneart

extension model yii state

23/09 2014

dev-master

9999999-dev

extension for yii1

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

  • php >=5.3.0

by oneart

extension model yii state