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

Conversation

Projects
4 participants
@scrnjakovic
Copy link
Contributor

scrnjakovic commented Sep 21, 2018

This addresses #13498

  • Type: enchancement and possibly bug fix
  • Link to issue: #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

scrnjakovic added some commits Sep 21, 2018

Fixed variable names causing CI to fail
Fixed my earlier fix that fixed correct variables and left incorrect
Changes to Element::getValue() and Element::Clear()
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

@scrnjakovic scrnjakovic referenced this pull request Sep 21, 2018

Closed

Changes to Element::getValue() method #13499

2 of 3 tasks complete

scrnjakovic added some commits Sep 21, 2018

Fixes Element::getValue
Properly returns value if form does not exist
@@ -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)

This comment has been minimized.

@Jurigag

Jurigag Sep 22, 2018

Member

Add it at the end of section instead of beginning

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

This comment has been minimized.

@Jurigag

Jurigag Sep 22, 2018

Member

fields === null

scrnjakovic added some commits Sep 22, 2018

@scrnjakovic

This comment has been minimized.

Copy link
Contributor Author

scrnjakovic commented Sep 24, 2018

@Jurigag All fine now?

@niden

niden approved these changes Oct 10, 2018

@niden

This comment has been minimized.

Copy link
Member

niden commented Oct 10, 2018

@scrnjakovic Thank you!

@niden niden merged commit 06d63ad into phalcon:4.0.x Oct 10, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@sergeyklay sergeyklay added the Feature label Oct 19, 2018

@sergeyklay sergeyklay added this to the 4.0.0 milestone Oct 19, 2018

@niden niden added this to Done in 4.0 Release Dec 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment