Doctrine and AMF Mapping

If you’re working on integrating Doctrine and AMF, here’s a little trick that may help save you some steps in type mapping your results. NOTE: This only works for Zend_Amf and not AMFPHP. There seems to be a serialization problem with AMFPHP that I’ve yet to figure out.

Keep in mind the Doctrine Manual has you do this in the setTableDefinition() function but that doesn’t seem to work. Make sure it’s in the constructor of your generated models instead.

class Widget extends BaseWidget
	public function construct(){

Now when you pass results from Doctrine through AMF, the “_explictType” property will be set and your receiving end will see them as the intended typed object and not Proxy objects.   We could have also put this in the BaseWidget Class instead too.