N°8891 - feat(DBObject): Add CopyIfNull() helper to copy attribute only if target is null#771
Open
favincen wants to merge 3 commits intoCombodo:developfrom
Conversation
Member
|
Hey @favincen, thank you for your PR. It has been functional accepted - which is normal given the content of the documentation 😁 We'll review it from a technical point of view |
Hipska
reviewed
Dec 8, 2025
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
favincen
commented
Dec 8, 2025
| return $this->Copy($sDestAttCode, $sSourceAttCode); | ||
| } | ||
| $this->SetIfNull($sDestAttCode, $this->Get($sSourceAttCode)); | ||
| return true; |
Contributor
Author
There was a problem hiding this comment.
Note to Combodo: Set() and Copy() do return true unconditionaly upon completion, but SetIfNul() do not return any value. Seems unconsistant to me.
So how do this new CopyIfNull() method should behave concerning returning value ?
Contributor
Author
There was a problem hiding this comment.
And should SetIfNull() be updated to return a boolean upon completion ?
Hipska
approved these changes
Dec 8, 2025
Contributor
Hipska
left a comment
There was a problem hiding this comment.
The doc needs to be updated a bit, but over-all its ok
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base information
Objective (enhancement)
DBObject provides helpers like Set(), SetIfNul(), and Copy(), but misses CopyIfNull().
CopyIfNull() is documented and recommended by Combodo in its partners documentation, and is really useful for its purpose.
Documentation states a PR to add this helper would be welcomed, so here it is.
Proposed solution (bug and enhancement)
Add the missing helper method in iTop, as it is documented.
Checklist before requesting a review
Checklist of things to do before PR is ready to merge