Skip to content

Instantly share code, notes, and snippets.

@havvg
Created October 18, 2012 12:35
Show Gist options
  • Select an option

  • Save havvg/3911512 to your computer and use it in GitHub Desktop.

Select an option

Save havvg/3911512 to your computer and use it in GitHub Desktop.
Propel ModelType collection
<?php
namespace Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class DummyType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('products', 'collection', array(
'type' => 'model',
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'prototype_name' => 'product___name__',
'options' => array(
'class' => 'Model\Product',
'property' => 'name',
'label' => 'label.product',
),
))
;
}
public function getName()
{
return 'dummy';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment