Sélection des modèles à garder
[zf2.biz/galerie.git] / module / Galerie / src / Galerie / Controller / IndexController.php
1 <?php
2
3 namespace Galerie\Controller; 
4
5 use Zend\Mvc\Controller\AbstractActionController; 
6 use Zend\View\Model\ViewModel;
7
8 class IndexController extends AbstractActionController 
9 {
10
11     private $_galerieTable;
12     private $_galerieInfoTable;
13
14
15     private function _getGalerieTable()
16     {
17         if (!$this->_galerieTable) {
18             $sm = $this->getServiceLocator();
19             $this->_galerieTable = $sm->get('Galerie\Model\GalerieTable');
20         }
21         return $this->_galerieTable;
22     }
23
24     private function _getGalerieInfoTable()
25     {
26         if (!$this->_galerieInfoTable) {
27             $sm = $this->getServiceLocator();
28             $this->_galerieInfoTable = $sm->get('Galerie\Model\GalerieInfoTable');
29         }
30         return $this->_galerieInfoTable;
31     }
32
33
34     public function indexAction() 
35     { 
36         return new ViewModel(array(
37             'Galerie_all' => $this->_getGalerieTable()->all(),
38             'Galerie_one' => $this->_getGalerieTable()->get(1),
39             'GalerieInfo_all' => $this->_getGalerieInfoTable()->select(),
40             'GalerieInfo_one' => $this->_getGalerieInfoTable()->select(array('gallery.id' => 1))->current(),
41             'GalerieInfo_usr' => $this->_getGalerieInfoTable()->select(array('gallery.id_user' => 1)),
42         )); 
43     } 
44
45     public function editAction() 
46     { 
47         return array(); 
48     } 
49
50     public function delAction() 
51     { 
52         return array(); 
53     } 
54
55     public function viewAction() 
56     { 
57         return array(); 
58     } 
59