Skip to content

Instantly share code, notes, and snippets.

View gpfiel's full-sized avatar

Gabriel Pinheiro Fiel gpfiel

View GitHub Profile
<?php
namespace Application\Controller;
use Zend\View\Model\ViewModel;
use Zend\Mvc\Controller\AbstractActionController;
class ClienteServiceController extends AbstractActionController
{
// Armazena na variável o endereço do webserver no servidor
<?php
namespace Admin\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
* @ORM\Table(name="funcionario")
*/
@gpfiel
gpfiel / Album.php
Created November 25, 2013 17:54
Bug while check isValid() on runtime isValid() the system redirect to 'home'... The problem is related to DATE while im using the firefox, i needed to use the modernizr with datepicker for (safari, internet explorer and firefox), on chorme it works ok! But when i set the datepicker to format pt_BR somethign happens and the system does not valid …
<?php
namespace Admin\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\Common\Collections\ArrayCollection;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
<?php
namespace Admin\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\Common\Collections\ArrayCollection;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
@gpfiel
gpfiel / AlbumController.php
Created November 21, 2013 15:53
Create photo to album
<?php
$album = new Album;
$photo = new Photo;
if(isset($_POST['id']))
$album = $this->getEntityManager()->getRepository('Admin\Entity\Album')->find($this -> params() -> fromPost('id'));
$photo -> setDate(date_create($_POST['date_photo']));
$photo -> setDescription($_POST['description_photo']);
$photo -> setMainPhoto($novo_nome);
@gpfiel
gpfiel / Album.php
Created November 20, 2013 19:25
Create a doctrine function to get Photos from Album
<?php
namespace Admin\Entity;
use Doctrine\ORM\Mapping as ORM,
Doctrine\Common\Collections\ArrayCollection;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
object(Admin\Entity\Album)[345]
private 'id' => null
private 'title' => null
private 'description' => null
private 'mainPhoto' => null
private 'date' => null
private 'status' => null
protected 'assignedPhotos' =>
object(Doctrine\Common\Collections\ArrayCollection)[346]
private '_elements' =>
@gpfiel
gpfiel / AlbumController.php
Last active December 28, 2015 19:29
Loop
<?php
public function editAction()
{
$album = new Album;
if ($this->params('id') > 0)
$album = $this->getEntityManager()->getRepository('Admin\Entity\Album')->find($this->params('id'));
$form = new AlbumForm($this->getEntityManager());
public function addAction()
{
$album = new Album;
$form = new AlbumForm($this->getEntityManager());
$form->setHydrator(new DoctrineEntity($this->getEntityManager(),'Admin\Entity\Album'));
$form->bind($album);
<?php
public function addAction()
{
$album = new Album;
$form = new AlbumForm($this->getEntityManager());
$form->setHydrator(new DoctrineEntity($this->getEntityManager(),'Admin\Entity\Album'));