/** * * @param OnlineProduct $product * Constructor */ public function __construct(OnlineProduct $product = null) { if (null != $product) { $this->label = $product->getLabel(); $this->price = $product->getPrice(); $this->vat = $product->getVat(); $this->product = $product; } else { $this->price = 0; $this->vat = 0; } $this->dtCrea = new \DateTime('now'); }
/** * Form builder * * @param FormBuilderInterface $builder * @param array $options * * @return null */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('title', TextType::class, array('label' => 'Product.title.label')); $builder->add('label', TextType::class, array('label' => 'Product.label.label')); $builder->add('description', TextareaType::class, array('label' => 'Product.description.label')); $builder->add('price', NumberType::class, array('label' => 'Product.price.label')); $builder->add('vat', NumberType::class, array('label' => 'Product.vat.label')); $builder->add('lockout', ChoiceType::class, array('label' => 'Product.lockout.label', 'choices_as_values' => true, 'choices' => OnlineProduct::choiceLockout(), 'attr' => array('choice_label_trans' => true))); }
/** * Form builder * * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('lockout', ChoiceType::class, array('label' => 'Product.lockout.label', 'choices_as_values' => true, 'choices' => OnlineProduct::choiceLockout(), 'attr' => array('choice_label_trans' => true))); }