Advertisement
fernandezekiel

Untitled

Jun 30th, 2014
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1.     private static $_yourData;
  2.  
  3.     public static function getAll()
  4.     {
  5.         if (static::$_yourData === null) {
  6.             static::$_yourData = static::model()->findAll();
  7.         }
  8.         return static::$_yourData;
  9.     }
  10.  
  11. call it like :
  12. $myModels = MyModel::getAll();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement