Skip to content

Instantly share code, notes, and snippets.

@juizmill
juizmill / gist:4974445
Created February 18, 2013 00:52
Classe para email com ZF2
<?php
namespace Base\Mail;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mail\Message;
use Zend\View\Model\ViewModel;
use Zend\Mime\Message as MimeMessage;
@juizmill
juizmill / gist:4974465
Created February 18, 2013 00:55
arquivo GLOBAL do ZF2 com a configuração para disparar e-mail
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
@juizmill
juizmill / global.php
Last active December 24, 2015 03:29
Exemplo de como recuperar dados de configuração direto do global.php ou local.php
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
@juizmill
juizmill / paginator.phtml
Created December 28, 2013 23:59
Código paginator para ZF2
<?php
$urlPattern = $_SERVER['REQUEST_URI'];
$formatUrl = function ($page) use ($urlPattern) {
if (!preg_match('/page/', $urlPattern))
return $urlPattern . '/page/' . (int) $page;
else
return preg_replace('@/page/(\d+)@', '/page/' . (int) $page, $urlPattern);
};
?>
@juizmill
juizmill / getFormElementConfig
Last active August 29, 2015 13:57
getFormElementConfig com DOCTRINE FORM ELEMENT
public function getFormElementConfig()
{
return array(
'factories' => array(
'user.form' => function($sm){
$em = $sm->getServiceLocator()->get('doctrine.entitymanager.orm_default');
$builder = new AnnotationBuilder();
$form = $builder->createForm('User\Entity\User');
@juizmill
juizmill / gist:11057666
Created April 18, 2014 18:22
TDD UserControlleTest
<?php
/**
* WebPatterns (http://webpatterns.com.br/)
*
* @copyright Copyright (c) 2014-2014. (http://www.webpatterns.com.br)
* @license http://webpatterns.com.br/license
*/
namespace UserTest\WPAclTest\Controller;
@juizmill
juizmill / gist:11057990
Created April 18, 2014 18:29
TestCaseController
<?php
/**
* WebPatterns (http://webpatterns.com.br/)
*
* @copyright Copyright (c) 2014-2014. (http://www.webpatterns.com.br)
* @license http://webpatterns.com.br/license
*/
namespace WPAclTest\Framework;
@juizmill
juizmill / gist:11058532
Created April 18, 2014 18:42
partials/paginator.phtml
<?php
$urlPattern = $_SERVER['REQUEST_URI'];
$formatUrl = function ($page) use ($urlPattern) {
if (!preg_match('/page/', $urlPattern))
return $urlPattern . '/page/' . (int) $page;
else
return preg_replace('@/page/(\d+)@', '/page/' . (int) $page, $urlPattern);
};
?>
<?php if ($this->pageCount > 1): ?>
@juizmill
juizmill / gist:11061286
Created April 18, 2014 19:46
Factory Form
<?php
/**
* WebPatterns (http://webpatterns.com.br/)
*
* @copyright Copyright (c) 2014-2014. (http://www.webpatterns.com.br)
* @license http://webpatterns.com.br/license
*/
namespace WPAcl\Form;
@juizmill
juizmill / gist:11070737
Created April 19, 2014 01:23
AclControllerPlugin
<?php
/**
* WebPatterns (http://webpatterns.com.br/)
*
* @copyright Copyright (c) 2014-2014. (http://www.webpatterns.com.br)
* @license http://webpatterns.com.br/license
*/
namespace WPAcl\Plugin;