Guest User

Untitled

a guest
Jul 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2.  
  3. class Db_Model_User extends Db_Model_BaseUser
  4. {
  5. public static function findAll(){
  6. return Doctrine::getTable('Db_Model_User')->findAll();
  7. }
  8.  
  9. public static function find($id){
  10. return Doctrine::getTable('Db_Model_User')->find($id);
  11. }
  12.  
  13. public function preInsert($event){
  14. $this->password = md5($this->password);
  15. }
  16.  
  17. public function preUpdate($event){
  18. $this->password = md5($this->password);
  19. }
  20. }
  21.  
  22. // Controller
  23.  
  24. $user = Db_Model_User::find(id);
  25. $user->name = 'New name';
  26. $user->save();
  27.  
  28. ?>
Add Comment
Please, Sign In to add comment