Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // src/Dessin/PlumeBundle/Form/Type/PlumeOptionsType.php
- namespace Dessin\PlumeBundle\Form\Type;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\FormBuilder;
- use Doctrine\ORM\EntityRepository;
- use Dessin\ProfileBundle\Entity\Profile;
- class PlumeOptionsType extends AbstractType
- {
- protected $profile;
- public function __construct ($profile1)
- {
- $this->profile = $profile1;
- }
- public function buildForm(FormBuilder $builder, array $options)
- {
- //$builder->add('framePlume');
- $builder->add('cartridgePlume');
- $builder->add('noticePlume');
- $builder->add('activePalette');
- //echo "data" . $this->profile;
- $builder->add('framePlume', 'entity', array(
- 'class' => 'DessinPlumeBundle:PhysicalPlume',
- 'query_builder' => function(EntityRepository $er) {
- return $er->createQueryBuilder('pp')
- ->where("pp.profile = :profile")
- ->orderBy('pp.index', 'ASC')
- //->setParameter('profile', $this->profile)
- ->setParameter('profile', 1)
- ;
- },
- ));
- }
- public function getName()
- {
- #should return a unique identifier for this form "type"
- return 'plumeOptions';
- }
- public function getDefaultOptions(array $options)
- {
- return array(
- 'data_class' => 'Dessin\PlumeBundle\Entity\PlumeOptions',
- 'csrf_protection' => true,
- 'csrf_field_name' => '_token',
- // a unique key to help generate the secret token
- 'intention' => 'plumeOptions_item',
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement