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

FIX load fields if lazy ones exists #6604

Conversation

andrewandante
Copy link
Contributor

Resolves #6603

Bonus test for good measure.

@andrewandante andrewandante force-pushed the FIX/hydrate-lazy-fields-on-dbobject branch from f77a410 to e862f76 Compare February 7, 2017 15:21
$tableClass = $this->record[$fieldName . '_Lazy'];
$this->loadLazyFields($tableClass);

$value = isset($this->record[$fieldName]) ? $this->record[$fieldName] : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we do need to investigate how a $field . '_Lazy' can still be unset after calling loadLazyFields

Copy link
Member

Choose a reason for hiding this comment

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

!$value matches false. would suggest using !isset($this->record[$fieldName]) in this if block instead, and moving the value-setter on line 2724 to below this if clause. then line 2732 isn't needed.

sminnee
sminnee previously requested changes Feb 7, 2017
$tableClass = $this->record[$fieldName . '_Lazy'];
$this->loadLazyFields($tableClass);

$value = isset($this->record[$fieldName]) ? $this->record[$fieldName] : null;
Copy link
Member

Choose a reason for hiding this comment

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

!$value matches false. would suggest using !isset($this->record[$fieldName]) in this if block instead, and moving the value-setter on line 2724 to below this if clause. then line 2732 isn't needed.

@andrewandante
Copy link
Contributor Author

Reordered as per @sminnee recommendations - failing test is the code coverage one.

@dhensby dhensby merged commit d5c9edd into silverstripe:master Feb 8, 2017
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.

None yet

3 participants