Skip to content

Instantly share code, notes, and snippets.

@cornernote
Created May 26, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cornernote/603ebdb5552faea90251 to your computer and use it in GitHub Desktop.
Save cornernote/603ebdb5552faea90251 to your computer and use it in GitHub Desktop.
<?php
namespace app\components;
class ActiveRecord extends \yii\db\ActiveRecord
{
public function safeAttributes()
{
$attributes = array();
$_attributes = parent::safeAttributes();
foreach ($this->attributes as $attribute) {
if (in_array($attribute, $_attributes)) {
$attributes[] = $attribute;
}
}
return $attributes;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment