This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin; | |
// module/Admin/config/module.config.php: | |
return array( | |
'controllers' => array( //add module controllers | |
'invokables' => array( | |
'Admin\Controller\Index' => 'Admin\Controller\IndexController', | |
'Admin\Controller\Auth' => 'Admin\Controller\AuthController', | |
'Admin\Controller\User' => 'Admin\Controller\UserController', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'doctrine' => array( | |
'connection' => array( | |
'driver' => 'pdo_mysql', | |
'host' => 'localhost', | |
'port' => '3306', | |
'user' => 'zend', | |
'password' => 'zend', | |
'dbname' => 'zf2napratica' | |
) | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Doctrine\ORM\EntityManager' => function($sm) { | |
$config = $sm->get('Configuration'); | |
$doctrineConfig = new \Doctrine\ORM\Configuration(); | |
$cache = new $config['doctrine']['driver']['cache']; | |
$doctrineConfig->setQueryCacheImpl($cache); | |
$doctrineConfig->setProxyDir('/tmp'); | |
$doctrineConfig->setProxyNamespace('EntityProxy'); | |
$doctrineConfig->setAutoGenerateProxyClasses(true); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin\Model; | |
use Zend\InputFilter\Factory as InputFactory; | |
use Zend\InputFilter\InputFilter; | |
use Zend\InputFilter\InputFilterAwareInterface; | |
use Zend\InputFilter\InputFilterInterface; | |
use Core\Model\Entity; | |
use Doctrine\ORM\Mapping as ORM; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin\Form; | |
use Zend\Form\Form; | |
class User extends Form | |
{ | |
public function __construct() | |
{ | |
parent::__construct('user'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin\Controller; | |
use Zend\View\Model\ViewModel; | |
use Core\Controller\ActionController; | |
use Admin\Model\User; | |
use Admin\Form\User as UserForm; | |
use Doctrine\ORM\EntityManager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="actions clearfix"> | |
<div class="btns"> | |
<a class="btn submit" href="/admin/user/save" title="Criar Usuário">Criar Usuário</a> | |
</div> | |
</div> | |
<label class="divisor"><span>Lista de Usuários</span></label> | |
<table class="datatable"> | |
<thead> | |
<tr> | |
<th>Nome</th> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'db' => array( | |
'driver' => 'PDO', | |
'dsn' => 'mysql:dbname=zf2napratica_test;host=localhost', | |
'username' => 'zend', | |
'password' => 'zend', | |
'driver_options' => array( | |
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'' | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin\Model; | |
use Core\Test\ModelTestCase; | |
use Admin\Model\User; | |
use Zend\InputFilter\InputFilterInterface; | |
/** | |
* @group Model | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Core\Test\ControllerTestCase; | |
use Admin\Controller\IndexController; | |
use Admin\Model\User; | |
use Zend\Http\Request; | |
use Zend\Stdlib\Parameters; | |
use Zend\View\Renderer\PhpRenderer; | |
/** |