Suppose I have a User class with \'name\' and \'password\' properties, and a \'save\' method. When serializing an object of this class to JSON via json_encode, the method is pro
You could create a FactoryClass of some sort:
function create(array $data) { $user = new User(); foreach($data as $k => $v) { $user->$k = $v; } return $user; }
It's not like the solution you wanted, but it gets your job done.