Closed kinglozzer closed 1 year ago
Anyone have any feedback on this? It’s still causing me issues 😞
I'm not against it, but as Guy said on the issue, it's hard to foresee the potential implications and what this could break, mainly about the backend.
Could you try a mixed solution where we keep the method and update the implementation to e.g.
/**
* Create an equivalent DBFile object
* @return AssetContainer
*/
private function copyImageBackend(): AssetContainer
{
$file = clone $this;
$backend = $this->getImageBackend();
if ($backend) {
$file->setImageBackend($backend);
}
return $file->setOriginal($this);
}
and then in the setAttribute
keep it as it was and add the cache clear call. Can you test if that would still work for you? If so, I'd be probably ok with that.
Thanks @michalkleiner, I’ve pushed up a new commit with what you’ve suggested
Thanks for the update @kinglozzer. Don't want to be too annoying, but do you think we can add a test for this that would fail with the original implementation?
Have added a simple test that fails with the original implementation
Legend, will try to have a look later today and get this in.
Released as 1.12.1
Proposed solution to #513 - pushing to see if CI builds pass.
Currently calling
Image::setAttributes()
will return aDBFile
instance instead of a modified copy of the original image, this changes that behaviour. BothImage
andDBFile
implement theAssetContainer
interface so this isn’t a BC break