Hi,
I have a requirement to accept an array of checked items from a table and update a field based on which items have been selected. Initially my thoughts where to simply loop over each of these items in the array and access a function in the specific class to update the status.
I'm slightly concerned about this approach as it would mean instantiating an object for each iteration of the loop in order to update the relevant status.
foreach($example as $exampleId){
$newExample=new Example($exampleId);
$newExample->updateStatus('active');
}
Are there any better ways around this? This seems like bad practice but I'm struggling to find an alternative way.