By itself it does not seem to make sense, but perhaps you can show the surrounding code to better provide clarity? I mean maybe they needed to change a clone but keep the original for something else
Jul 17, 2022
4
Level 8
Is there any reason to use with(clone $model)?
I was working on a code that loads way too much data (75+ MB in resources), and I noticed they used something like:
$model = with(clone $model)->... // (Yes, same model instance lol)
I've never seen anything like that but I know it's a new developer who worked on it. But maybe there is a reason he did that with guidance from other experienced developers that were there previously? I suspect this is part of the massive amount of resources that the page loads
Please or to participate in this conversation.