I don't think you are looking at this correctly.
When you try to set $customer->home_address->country
, you are trying to set a property on the stdClass()
object that is set to home_addresss
property of $customer
. This would in no way invoke a setter on $customer
.
Your initial setting of home_address
does in invoke the __set()
magic method as home_address
is not defined as a property on Person
class.