Skip to content

Instantly share code, notes, and snippets.

View fabiocarneiro's full-sized avatar

Fábio Carneiro fabiocarneiro

View GitHub Profile
<?php
/**
* @author Marco Pivetta <ocramius@gmail.com>
*/
use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfig;
use DoctrineORMModuleTest\Framework\TestCase;
use ContentTest\Util\ServiceManagerFactory;
use Zend\Loader\StandardAutoloader;
@fabiocarneiro
fabiocarneiro / main.cpp
Last active December 20, 2015 02:49
daniel cara de pastel
/*
* File: main.cpp
* Author: Fabio
*
* Created on July 22, 2013, 9:52 PM
*/
#include <stdio.h>
#include <stdlib.h>
public function getFreightForm() {
$form = new Form();
$items = $this->session->offsetGet('list');
foreach ($items as $i => $consumer) {
$fieldset = new Fieldset($i);
foreach ($consumer->getItems() as $token => $item) {
$fieldset->add(array(
'type' => 'text',
class cart {
public $item;
public function getItem() {
return $this->item;
}
public function setItem(&$item) {
$this->item = $item;
}
<?php
namespace Cart;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
class Module
{
<?php
use Zend\Form\Fieldset;
use Zend\Form\Form;
use Zend\Form\View\Helper\Form as FormHelper;
use Zend\Form\View\HelperConfig;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\Hydrator\ObjectProperty;
use Zend\View\Renderer\PhpRenderer;
-- element --
string 'Cart\Form\ProductFieldset' (length=25)
-- object --
object(Product\Entity\Product)[539]
protected 'id' => int 31
protected 'sku' => string 'PH043' (length=5)
protected 'name' => string 'FONE COM MICROFONE USB DIGITAL PC / PLAYSTATION 3' (length=49)
protected 'slug' => string 'fone-com-microfone-usb-digital-pc-playstation-3' (length=47)
-- hydrator target class --
string 'Product\Entity\Product' (length=22)
<?php
public function addAction()
{
$album = new Album;
$form = new AlbumForm($this->getEntityManager());
$form->setHydrator(new DoctrineEntity($this->getEntityManager(),'Admin\Entity\Album'));
public function extract()
{
if ($this->object instanceof Traversable) {
$this->object = ArrayUtils::iteratorToArray($this->object, false);
}
if (!is_array($this->object)) {
return array();
}
<?php
class Router {
protected $routes = array();
protected $namedRoutes = array();
protected $basePath = '';
protected $matchTypes = array(
'i' => '[0-9]++',
'a' => '[0-9A-Za-z]++',