Skip to content

Instantly share code, notes, and snippets.

View miguelplazasr's full-sized avatar

Miguel Plazas miguelplazasr

  • Pulsar IT
  • Miami, FL
View GitHub Profile
@miguelplazasr
miguelplazasr / Country.php
Created September 7, 2015 22:38
Entity Country for Symfony Project
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* AppBundle\Entity\Country
@miguelplazasr
miguelplazasr / State.php
Created September 7, 2015 22:41
Entity State for Symfony Project
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
/**
@miguelplazasr
miguelplazasr / City.php
Created September 7, 2015 22:42
Entity City for Symfony Project
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
/**
@miguelplazasr
miguelplazasr / LoadCountries.php
Created September 8, 2015 01:11
Load Counties, Colombian States and Colombian Cities, DataFixtures
<?php
namespace AppBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use AppBundle\Entity\Country;
use AppBundle\Entity\State;
use AppBundle\Entity\City;
@miguelplazasr
miguelplazasr / AddCountryFieldSubscriber.php
Created September 8, 2015 01:40
Country Subscriber for AddressType
<?php
namespace AppBundle\Form\EventListener;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AddCountryFieldSubscriber implements EventSubscriberInterface
@miguelplazasr
miguelplazasr / AddStateFieldSubscriber.php
Created September 8, 2015 01:40
States Subscriber for AddressType when Select Countries
<?php
namespace AppBundle\Form\EventListener;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Doctrine\ORM\EntityRepository;
@miguelplazasr
miguelplazasr / AddCityFieldSubscriber.php
Created September 8, 2015 01:41
City Subscriber for AddressType when select States
<?php
namespace AppBundle\Form\EventListener;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Doctrine\ORM\EntityRepository;
@miguelplazasr
miguelplazasr / AjaxController.php
Created September 8, 2015 01:44
Ajax Controller for a country, state and city selects
<?php
namespace AppBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
/**
@miguelplazasr
miguelplazasr / StateRepository.php
Created September 8, 2015 01:52
State Query by Country
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* StateRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
@miguelplazasr
miguelplazasr / CityRepository.php
Created September 8, 2015 01:52
City Query by State
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* CityRepository
*
* This class was generated by the Doctrine ORM. Add your own custom