Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Dúvida referente ao post http://forum.tableless.com.br/t/ajuda-com-o-this-e-self/1095
- //$u = new User();
- //$u->find();
- echo "<pre>";
- var_dump(User::forge()->find());
- class BaseModel
- {
- private $_table = null;
- public function __construct($table)
- {
- $this->_table = $table;
- }
- public function find(array $params = [])
- {
- die($this->table);
- }
- }
- class User extends BaseModel
- {
- protected $table = "users";
- public function __construct()
- {
- $this->_table = $this->table;
- }
- public static function forge()
- {
- return new self;
- }
- public function find(array $params = [])
- {
- parent::find($params);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment