liqiusheng / silverstripe-ecommerce

Automatically exported from code.google.com/p/silverstripe-ecommerce
0 stars 0 forks source link

Fatal error: Cannot access property ModelAdminEcommerceBaseClass::$managed_models in C:\wamp\www\ecommerce\code\cms\ModelAdminEcommerceBaseClass.php on line 22 #525

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
e-commerce version: 3.1 (26/03/2013)

SilverStripe version: 3.1 from github (26/03/2013)

Fatal error: Cannot access property 
ModelAdminEcommerceBaseClass::$managed_models in 
C:\wamp\www\ecommerce\code\cms\ModelAdminEcommerceBaseClass.php on line 22

Now the $managed_models property of the ModelAdmin class is private, so you can 
not access it from a inherited class, do it with Config::get.

Regards,
Jose A.

Original issue reported on code.google.com by supp...@sendasoft.com on 26 Mar 2013 at 7:12

GoogleCodeExporter commented 8 years ago
Hi Jose

We are coming back to this project next week. 

Original comment by nfranc...@gmail.com on 29 Mar 2013 at 3:01

GoogleCodeExporter commented 8 years ago
With the latest version of ECommerce 3.1 (22/04/2013) still not working:

If click 'Shop Settings' menu option in CMS:
--------------------------------------
( ! ) SCREAM: Error suppression ignored for
( ! ) Fatal error: Cannot access property 
ModelAdminEcommerceBaseClass::$managed_models in 
C:\wamp\www\ecommerce\code\cms\ModelAdminEcommerceBaseClass.php on line 22
Call Stack
#   Time    Memory  Function    Location
1   0.0006  721912  {main}( )   ..\main.php:0
2   0.1743  24471448    Director::direct( ) ..\main.php:128
3   0.1781  24881768    Director::handleRequest( )  ..\Director.php:143
4   0.1811  25046112    AdminRootController->handleRequest( )   ..\Director.php:325
5   0.2111  28292400    LeftAndMain->handleRequest( )   ..\AdminRootController.php:89
6   0.2112  28292400    Controller->handleRequest( )    ..\LeftAndMain.php:397
7   0.2112  28291424    StoreAdmin->init( ) ..\Controller.php:139
8   0.2112  28291424    ModelAdmin->init( ) ..\StoreAdmin.php:50
9   0.3970  36651944    ModelAdminEcommerceBaseClass->getManagedModels( 
)   ..\ModelAdmin.php:116
--------------------------------------

You should check this problem with the latest version of SilverStripe:
https://github.com/silverstripe/silverstripe-cms/tree/3.1
https://github.com/silverstripe/sapphire/tree/3.1

Thanks Nicolaas,
Regards,
Jose A.

Original comment by supp...@sendasoft.com on 22 Apr 2013 at 4:16

GoogleCodeExporter commented 8 years ago
With the latest version of ECommerce 3.1 (23/04/2013) still not working. :(

Original comment by supp...@sendasoft.com on 23 Apr 2013 at 1:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi Nicolaas,

I think this problem can be solved as follows:
class ModelAdminEcommerceBaseClass extends ModelAdmin {

    /**
     * @return array Map of class name to an array of 'title' (see {@link $managed_models})
     */
    function getManagedModels() {
        $models = EcommerceConfig::get($this->class, "managed_models");
        foreach($models as $key => $model) {
            if(!class_exists($model)) {
                unset($models[$key]);
            }
        }
        // self::$managed_models = $models;
        Config::inst()->update('ModelAdmin','managed_models', $models);
        return parent::getManagedModels();
    }
 ....
 ....
}

Regards,
Jose A.

Original comment by supp...@sendasoft.com on 17 May 2013 at 7:24

GoogleCodeExporter commented 8 years ago
this should be fixed...

Original comment by nfranc...@gmail.com on 22 May 2013 at 10:03

GoogleCodeExporter commented 8 years ago
In the ecommerce last version (10/06/2013) this error still occurs.

Regards,
Jose A.

Original comment by supp...@sendasoft.com on 10 Jun 2013 at 11:04