Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes implementation of form's and element's getValue() and clear() methods #13500

Merged
merged 9 commits into from
Oct 10, 2018
Merged

Changes implementation of form's and element's getValue() and clear() methods #13500

merged 9 commits into from
Oct 10, 2018

Conversation

scrnjakovic
Copy link
Contributor

@scrnjakovic scrnjakovic commented Sep 21, 2018

This addresses #13498

  • I have read and understood the Contributing Guidelines?
  • I have checked that another pull request for this purpose does not exist.
  • I wrote some tests for this PR.

Small description of change:

  • Phalcon\Forms\Form::clear() method will no longer call Phalcon\Forms\Element::clear(), instead it will clear element's value itself
  • Phalcon\Forms\Element::clear() will now call Phalcon\Forms\Form::clear() passing its name or will clear itself if form does not exist
  • Phalcon\Forms\Element::getValue() will now call Phalcon\Forms\Form::getValue() or return its default value (instead of hardcoded null) if form does not exist
  • Phalcon\Forms\Form::getValue() will now try to get element's value from the Tag or by calling element's getDefault() method before returning null

More info: #13498

Fixed my earlier fix that fixed correct variables and left incorrect
Changes implementation of  `Phalcon\Forms\Element::getValue()` and `Phalcon\Forms\Element::clear()` methods
@scrnjakovic scrnjakovic changed the title Changes to Form::getValue() method Changes implementation of form's and element's getValue() and clear() methods Sep 21, 2018
Properly returns value if form does not exist
CHANGELOG-4.0.md Outdated
@@ -6,6 +6,8 @@
- Added `Phalcon\Mvc\ModelInterface::getModelsMetaData` [#13070](https://github.com/phalcon/cphalcon/issues/13402)

## Changed
- `Phalcon\Forms\Form::clear` will no longer call `Phalcon\Forms\Element::clear`, instead it will clear/set default value itself, and `Phalcon\Forms\Element::clear` will now call `Phalcon\Forms\Form::clear` if it's assigned to the form, otherwise it will just clear itself. [#13500](https://github.com/phalcon/cphalcon/pull/13500)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add it at the end of section instead of beginning

* If null, clear all
*/
if typeof elements == "array" {
if is_null(fields) {
Copy link
Contributor

Choose a reason for hiding this comment

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

fields === null

@scrnjakovic
Copy link
Contributor Author

@Jurigag All fine now?

@niden
Copy link
Member

niden commented Oct 10, 2018

@scrnjakovic Thank you!

@niden niden merged commit 06d63ad into phalcon:4.0.x Oct 10, 2018
@sergeyklay sergeyklay added the new feature request Planned Feature or New Feature Request label Oct 19, 2018
@sergeyklay sergeyklay added this to the 4.0.0 milestone Oct 19, 2018
@niden niden added the documentation Documentation required label Apr 9, 2019
@niden niden added 4.0 and removed documentation Documentation required labels Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature request Planned Feature or New Feature Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants