Skip to content

Instantly share code, notes, and snippets.

View apoca's full-sized avatar
🚀
Working hard with microservices infrastructure

Miguel Vieira apoca

🚀
Working hard with microservices infrastructure
View GitHub Profile
public function getUserAllInfoById($id) {
$select = new Select($this->table);
$select->where->equalTo('id', $id);
return $this->selectWith($select)->toArray();
}
in controller...
public function indexAction() {
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
@apoca
apoca / gist:7151567
Created October 25, 2013 08:48
my route structure
'router' => array (
'routes' => array (
'ajax' => array (
'type' => 'Segment',
'options' => array (
'route' => '/ajax[/:action]',
'constraints' => array (
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array (
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
return array (
'router' => array (
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace Application\Model;
use Zend\Db\Adapter\Adapter;
@apoca
apoca / gist:7706380
Last active December 29, 2015 17:49
// Module.php
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php',
array(
'Facebook' => 'vendor/facebook/php-sdk/src/facebook.php',
'Paypal' => 'vendor/paypal/lib/PayPal/AdaptivePayments/'
<?php
if (!isset($this->og_title)) {
$this->og_title = $this->translate('esolidar titulo');
}
$this->headMeta()
->prependName('viewport', 'width=device-width')
->prependHttpEquiv('X-UA-Compatible', 'IE=edge')
->prependHttpEquiv('X-Frame-Options', 'DENY')
->setName('description', $this->translate('A esolidar é um mercado online solidário. Compra, vende, partilha e contribui para um mundo melhor.'))
->setProperty('fb:app_id', $this->Config()['facebook']['api_id'])
In controller:
$job = new \Application\Job\EmailJob();
// Get the queue plugin manager
$queueManager = $this->serviceLocator->get('SlmQueue\Queue\QueuePluginManager');
$queue = $queueManager->get('teste');
$queue->push($job, array(
'priority' => 20,
@apoca
apoca / gist:9069327
Created February 18, 2014 11:35
Paypal sdk
use PayPal\Service\AdaptivePaymentsService;
use PayPal\Types\AP\Receiver;
use PayPal\Types\AP\ReceiverList;
use PayPal\Types\AP\PayRequest;
use PayPal\Types\Common\RequestEnvelope;
use PayPal\Service\AdaptiveAccountsService;
use PayPal\Types\AA\AccountIdentifierType;
use PayPal\Types\AA\GetVerifiedStatusRequest;
public function getControllerPluginConfig()
{
return array(
'factories' => array(
// call this key zmPlugin in your action controller
'emailsPlugin' => function ($sm)
{
$emailPluginController = new \Application\Controller\Plugin\EmailsPluginController();
$emailPluginController->setServiceManager($sm);
return $emailPluginController;