symfony - Define date steps in a form or property -


i have defined property use datetime type:

class myclass {  /**  * @constraints\notnull  * @orm\column(type="datetime")  */ private $date; ... } 

i have property added in form:

        $form = $this->createformbuilder($myclassobject)             ->add('date')             ->getform();          return $this->render('mytemplate', array('detailsform', $form->createview()); 

and form used inside mytemplate:

        <form method="post">             {{ form_widget(detailsform) }}             <input type="submit" value="create">         </form> 

but want display time 5 minutes steps:

00 - 05 - 10 - ... - 50 - 55 

is there way define property constraint or field's form definition?

the date field type date, have use datetime display minutes , seconds:

$form = $this->createformbuilder()     ->add('date', 'datetime', array(         'minutes' => range(0, 55, 5)     ))     ->getform(); 

the interesting part minutes options accept array of values minutes. option available datetime , time field types.

and suggest name object property date if contains date only, otherwise datetime better name.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -