Guest User

Untitled

a guest
Nov 14th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Main;
  4.  
  5.  
  6. class NewsRepository extends Repository {
  7.  
  8.     /**
  9.      * Vybratie všetkých noviniek
  10.      * @return Nette\Database\Table\Selection
  11.      */
  12.     public function getAllNews() {
  13.         return $this->getTable()->order('date DESC');
  14.     }
  15.  
  16.  
  17.     /**
  18.      * Pridanie novinky
  19.      * @return Nette\Database\Table\Selection
  20.      */
  21.     public function addNews($data, $user) {
  22.         $data['date'] = new \DateTime();
  23.         $data['author'] = $user;
  24.         return $this->getTable()->insert($data);
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment