Ver Mensaje Individual
  #9 (permalink)  
Antiguo 20/03/2014, 08:29
dschell
 
Fecha de Ingreso: junio-2003
Ubicación: Carlos Paz - Cordoba
Mensajes: 91
Antigüedad: 20 años, 10 meses
Puntos: 0
Respuesta: Doctrine ORM + FormBuilder en Silex para crear un formulario

no lo vas a creer, anduvo this facking shit!!!

gracias brother!!


--aqui el codigo---


MasEventos\Form\Type\VehicleType.php
------------------------------------

class VehicleType extends AbstractType

protected $_repository;

public function __construct($repository)
{
$this->_repository = $repository;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$cat = $this->_repository->findAll(200);

$builder->add('category','choice', array(
'choices' => $cat,
'required' => false));


src\MasEventos\Controller\VehicleController.php
-------------------------------------------------

class VehicleController

public function addAction(Request $request, Application $app)

$vehicle = new Vehicle();

$form = $app['form.factory']->create(new VehicleType($app['repository.category']), $vehicle);
__________________
Daniel Schell
Promoviendo el Desarrollo Humano
www.elsenderodelmedio.com.ar