Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class Activity extends Article
- {
- /**
- * Post a new activity
- */
- public static function newPost($heerId, $title, $contents, $date)
- {
- $newInfo = array();
- $newInfo['title'] = $title;
- $newInfo['contents'] = $contents;
- $newInfo['date'] = $date;
- $this->fromArray($newInfo)
- }
- }
- Class Article extends DBObject
- {
- function __construct($source = null)
- {
- $args = func_get_args();
- if (count($args) > 1) {
- call_user_func_array('newPost', $args);
- } else {
- parent::__construct($args);
- }
- }
- }
- Class DBObject
- {
- public $info;
- public $changed;
- public $changeSet;
- /**
- * Construct a new database model object. You can pass either a key-value array
- * or an sql query to the constructor.
- * @param Array Key-Value based array containing all info
- * @param Sql query where all values are replaced by %s %i etc., and provided
- * as extra arguments.
- */
- function __construct($source = null)
- {
- if (is_array($source))
- $this->fromArray($source);
- else if ($source != null) {
- $args = func_get_args();
- $this->fromSql($args);
- }
- if (!isset($this->info))
- $this->info = Array();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement