PHP Equivalent of Java Type-Casting Solution
- by stjowa
Since PHP has no custom-class type-casting, how would I go about doing the PHP equivalent of this Java code:
CustomBaseObject cusBaseObject = cusBaseObjectDao.readCustomBaseObjectById(id);
((CustomChildObject) cusBaseObject).setChildAttribute1(value1);
((CustomChildObject) cusBaseObject).setChildAttribute2(value2);
In my case, it would very nice if I could do this. However, trying this without type-casting support, it gives me an error that the methods do not exist for the object.
Thanks,
Steve