Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Feature/datetime factory format #3437

Merged

Conversation

pdobrigkeit
Copy link
Contributor

Added the setOptions function to the DateTime form element, which allows to set the accepted format, i.e. when using the array notation to define your elements and the factory.

* - format: A PHP date() compatible string
*
* @param array|\Traversable $options
* @return DateSelect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DateTime

Did not want to duplicate the check done in Element, but rather used to already converted $this->options instead
@@ -52,6 +52,24 @@ class DateTime extends Element implements InputProviderInterface
protected $validators;

/**
* Accepted options for DateTime:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use {@inheritDoc} to inherit parent method documentation too

@Ocramius
Copy link
Member

@pdobrigkeit missing tests?

* - format: A \DateTime compatible string
*
* @param array|\Traversable $options
* @return DateSelect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return type should be DateTime or Zend\Form\Element

@pdobrigkeit
Copy link
Contributor Author

Added a test. But someone should check the other form elements for
a) the same $options can be Traversable
b) there are no tests either

@Maks3w
Copy link
Member

Maks3w commented Jan 16, 2013

That is tested in ZendTest\Form\ElementTest

@pdobrigkeit
Copy link
Contributor Author

Take a look at for example Zend\Form\Element\Captcha. it also has its own setOptions and it uses $options['captcha']

Maks3w added a commit that referenced this pull request Jan 16, 2013
@Maks3w Maks3w merged commit 89adefa into zendframework:master Jan 16, 2013
Maks3w added a commit that referenced this pull request Jan 16, 2013
danizord pushed a commit to danizord/zf2 that referenced this pull request Jan 16, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants