HosipLan

Untitled

Jul 7th, 2011
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. <?php
  2.  
  3. class MyModel extends Nette\Object
  4. {
  5.  
  6.     /** @var DibiConnection */
  7.     private $db;
  8.  
  9.     public function __construct(DibiConnection $db)
  10.     {
  11.         $this->db;
  12.     }
  13.  
  14.     public function find()
  15.     {
  16.         $this->db->query('select * from ...');
  17.         // ...
  18.     }
  19.  
  20. }
  21.  
  22.  
  23.  
  24. // v configu
  25. services:
  26.     my:
  27.         class: MyModel
  28.         arguments: [@connection]
  29.  
  30. // nebo v presenteru
  31. $this->model = new MyModel($this->context->connection);
Advertisement
Add Comment
Please, Sign In to add comment