symfony - How to access service from FormType? -
i try access service formtype extended abstracttype. how can that?
thanks!
just inject services want through constructor form type.
class footype extends abstracttype { protected $barservice; public function __construct(barservice $barservice) { $this->barservice = $barservice; } public function buildform(formbuilderinterface $builder, array $options) { $this->barservice->dosomething(); // (...) } }
Comments
Post a Comment