Skip to content

Instantly share code, notes, and snippets.

View juliangorge's full-sized avatar
🏠
Working from home

Julián juliangorge

🏠
Working from home
View GitHub Profile
@juliangorge
juliangorge / MyFormFieldset.php
Created March 17, 2015 17:41
Convert a datepicker string to database date format.
<?php
class MyFormFieldset extends Fieldset implements InputFilterProviderInterface
{
public function __construct() //I am using DoctrineModule 2.. I remove it configuration.
{
/* ... */
$this->add(array(
'name' => 'date',
'type' => 'Zend\Form\Element\Text',
@juliangorge
juliangorge / Controller.php
Created March 16, 2015 23:13
ZF2 & DoctrineModule: Submitting a form with AJAX.
<?php
public function createAction()
{
$objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
$form = new \Admin\Form\RegisterForm($objectManager);
$register = new \Admin\Entity\Register();
$form->bind($register);
$viewmodel = new ViewModel();
$viewmodel->setTerminal($this->getRequest()->isXmlHttpRequest());
@juliangorge
juliangorge / Concursos.php
Last active August 29, 2015 14:16
My form with Ajax does not work (is not valid). Why?
<?php
namespace Admin\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="concursos")
*/