Closed YOzaz closed 6 years ago
Hi Marijus,
Thanks for suggesting the object model to us. What is the impact of this issue to your project / business?
@thangduo we are running background checker on DFP API, which scans for incorrectly set up line items - and fixes them as required. Therefore manipulating with CriteriaSets is one of the common things. We'll get away by re-assigning arrays, but just I though the way it is possible to amend object properties - as PHP passes objects by reference by default (like InventoryTargting) - without re-setting them through setter, it should be possible with other properties as well. Not crucial, but would eliminate lots of unnecessary code imho.
Do you expect to send back only the changes in the CriteriaSets? Or do you expect to send along with other corrections to the same line item?
To answer - we're doing more than that, e.g. pausing (or resuming) line item, changing target impressions goal, etc. So it's more like sending corrections to the same line item.
Hi Marijus,
Thanks for your answer. We took your suggestion and will investigate different ways to improve the memory handling aspect of the CriteriaSet.
In the meantime, we will close this issue out for now as it doesn't have crucial impacts on your end. Please feel free to re-open this issue if it would become crucial for you.
Thanks, Thang Duong
As properties have been closed to protected access,
CriteriaSet
array manipulation onLineItem
becomes troublesome - especially, when it has nested levels (which is default). Consider this - we want to append new targeting criteria at the end of the last set:Proposal: convert arrays to
ArrayObjects
: http://php.net/manual/en/class.arrayobject.php (or custom arrays withArrayAccess
) In that way, references will be carried over, and will allow direct manipulation. Note, this may be breaking change.Theory tests for proof: http://sandbox.onlinephpfunctions.com/code/6b21b80d2a7f7340471377105b5420331b250074