When creating a custom field in Symfony, there is a method that we define getParent
We define our class by extending the AbstractType class, then return the parent type using the getParent method. instead of extending from the parent class.
I want to know the philosophy of this approach.
Is it possible to define my custom type, for example:
class ImageType extends FileType { public function getName() { return 'image'; } }
instead of this:
class ImageType extends AbstractType { public function getParent() { return 'file'; } public function getName() { return 'image'; } }
If so, then what is the difference between these two approaches?
Thanks!
symfony symfony-forms
user3487498
source share