Skip to content

Codeigniter\Entity - Added $deep parameter in toArray and toRawArray #3495

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

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

najdanovicivan
Copy link
Contributor

Description

Added boolean $deep parameter in toArray and toRawArray methods. This parameters allows casting inner custom and entity objects to array as well

Additionally added :

  • Unit Tests
  • Return Type Declaration for Entity Getters to avoid IDE errors
  • Some Code Style Fixes

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

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

This is looking good. You missed one definition which is causing tests errors: tests/system/View/ParserTest.php:256

Get that fixed and see if anyone else has thoughts on the implementation.

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

I have only some small suggestions.

@paulbalandan
Copy link
Member

How about renaming the $deep parameter to $recursive? IMO it is more descriptive of what it does.

@najdanovicivan
Copy link
Contributor Author

How about renaming the $deep parameter to $recursive? IMO it is more descriptive of what it does.

@paulbalandan It makes sense to me using either of those names let's see what other think about it.

@MGatner
Copy link
Member

MGatner commented Aug 16, 2020

$recursive would be more consistent with other variable names in the framework already.

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

I believe both names: $deep and $recursive are correct and I have no preferences so I will agree with @MGatner and @paulbalandan here.

…methods

Additionally added :
  - Unit Tests
  - Return Type Declaration for Entity Getters to avoid IDE errors
  - Some Code Style Fixes
@najdanovicivan
Copy link
Contributor Author

@michalsn regarding the else if and elseif can we see to get this rule added in CodeSniffer standard ?

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

Good point with adding this to our standard. Just sent a PR: codeigniter4/coding-standard#30

@MGatner MGatner merged commit 91b534c into codeigniter4:develop Aug 17, 2020
@najdanovicivan najdanovicivan deleted the entity-deep branch August 17, 2020 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants