Discussion:
[mapguide-users] MapGuide 3.1 Ad Layer on Runtime PHP
Lisa Weber
2017-12-16 01:27:31 UTC
Permalink
I am updating codebase originally running on AIMS 2013 to MGOS 3.1 on Apache
and have hit an issue.





When updating code associated with calling a layer it keeps erroring out
before calling the layer. The error is:



PHP Fatal error: Class 'MgServiceType' not found in C:\Program
Files\OSGeo\MapGuide\Web\www\VIRTUAL\variety\region_variety_change_filter.ph
p on line 34



Line 34 of the code is $resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService).



Here is the code snippet setup used including the line that causes the
error:



require_once('../../mapviewerphp/common.php');

$webconfigFilePath = "C:/Program
Files/OSGeo/MapGuide/Web/www/webconfig.ini";

$mapName = $_REQUEST['MAPNAME'];

$sessionId = $_REQUEST['SESSION'];



MgInitializeWebTier ($webconfigFilePath);



$userinfo = new MgUserInformation($sessionId);

$siteConnection = new MgSiteConnection();

$siteConnection->Open($userinfo);

$resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);



I have confirmed that the MapGuide API still lists the class as used above.
I have other reports that I ported straight from AIMS to MGOS 3.1 that work
without issue, so I don't think the issue is code differences between AIMS
and MGOS3.1 but can't rule that out completely.



Is it possible that the code as used is not calling the class properly? Any
help would be appreciated.



Thanks,

Lisa
Jackie Ng
2017-12-16 02:26:07 UTC
Permalink
MgServiceType is a constant. All MapGuide API constants are found in
constants.php that should be in www/mapadmin or www/mapviewerphp

Meaning you're either missing an include/require_once to constants.php (or
your current path to it is incorrect).

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Lisa Weber
2017-12-16 03:24:03 UTC
Permalink
Jackie,

I had already tried adding in constants.php; it resolved that error but creates wrong parameter count errors for MgMap and another fatal error so I removed it as I hadn't needed it in AIMS.
Thanks for confirming it needs to remain.


Kind Regards,
Lisa

-----Original Message-----
From: mapguide-users [mailto:mapguide-users-***@lists.osgeo.org] On Behalf Of Jackie Ng
Sent: Saturday, 16 December 2017 12:26 PM
To: mapguide-***@lists.osgeo.org
Subject: Re: [mapguide-users] MapGuide 3.1 Ad Layer on Runtime PHP

MgServiceType is a constant. All MapGuide API constants are found in constants.php that should be in www/mapadmin or www/mapviewerphp

Meaning you're either missing an include/require_once to constants.php (or your current path to it is incorrect).

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
mapguide-***@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

Loading...