Reputation: 31558
Symfony Docs say that we can use birthday date in forms. but they have not given any example how to use that
Can anyone please tell me where do I need to write birthday
in doctrine entity?
Upvotes: 0
Views: 4126
Reputation: 1702
The Birthday is the form_widget.
ex. in controller:
$form = $this->createFormBuilder($task)
->add('task', 'text')
->add('yearOfBirth', 'birthday')
->getForm();
This widget can be mapped to DateTime field
/**
* @var date $yearOfBirth
*
* @ORM\Column(name="year_of_birth", type="datetime")
* @Assert\DateTime()
*/
private $yearOfBirth;
Here you got reference to docs about this field: http://symfony.com/doc/current/reference/forms/types/birthday.html
Regards, Max
Upvotes: 2
Reputation: 22756
$builder->add('dateOfBirth', 'birthday');
You have plenties of example on the internet:
Upvotes: 1