[mapguide-users] mgnullreferenceexception after MgLayer::GetClassDefinition()

Jackie Ng jumpinjackie at gmail.com
Thu Aug 7 04:34:02 PDT 2014

I theorize that $map and $layers might have been cleaned up after setLayer()

When you're calling GetClassDefinition() on the cached $this->layer, it
internally retrieves its parent map from its owner MgLayerCollection to
create the necessary MgFeatureService to fetch the class definition. But
because both the $map and $layers have been cleaned up, the parent map
reference is lost and that's probably where the MgNullReferenceException is
coming from:


Of course this is just a theory, which you can test by promoting $map up to
a class member variable instead of a local variable in setLayer().

- Jackie

View this message in context: http://osgeo-org.1560.x6.nabble.com/mgnullreferenceexception-after-MgLayer-GetClassDefinition-tp5155410p5155413.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

More information about the mapguide-users mailing list