Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class arUser extends ADOdb_Active_Record{}
- class User{
- static $user_table;
- var $record;
- function __construct($condition = false)
- {
- self::$user_table = new arUser('users');
- if($condition)
- {
- $this->record = self::$user_table->find($condition);
- }
- }
- function __get($property)
- {
- return $this->record[$property];
- }
- function __set($property, $value)
- {
- $this->record[0][$property] = $value;
- }
- static function getById($user_id)
- {
- $condition = "id = $user_id";
- return new User($condition);
- }
- static function getByHandle($handle)
- {
- $condition = "handle = '".$handle."'";
- return new User($condition);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment