Admin > ListController > $_sListClass - Looking for Namespace Solution

module
oxid6

#1

When i look arround the Admin ListController (OxidEsales\EshopCommunity\Application\Controller\Admin…XYZ…List) then i found the variable $_sListClass inside the Classes…

This variable is used in the classes for initializing the “oList” object (see OxidEsales\EshopCommunity\Application\Controller\Admin->getItemList ()). The content and usage of the variable still corresponds to the old OXID4 schema.

I am currently porting a module from OXID4 to OXID6. After the old scheme I have defined the module classes in the metadata.php. In OXID6, I do not need it anymore. There are now namespaces.

My problem is that I no longer define the short form of the class variable name anymore.

For a closer look, see OxidEsales\EshopCommunity\Application\Controller\Admin\ArticleList: At no point in my module do I define anymore what “oxarticle” = ‘OxidEsales\Eshop\Application\Model’ is , As it is possible here:
\Vendor\oxide-esales\oxides-shop-ce\source\Core\Autoload\BackwardsCompatibilityClassMap.php

When i set in my Module-ListClass the short Version of the Class-Name in the $_sListClass , then i´ve got the error EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND. If i used a namespace-Version i´ve got an SQL-Error. The class would initialized, but in the List-SQLs there is the namespace-Name instead of table name.

What should i do? I do not want a mix of old and new, just a clean OXID6 version


#2

Are you sure the error is not somewhere else? Because $_sListClass is not a table name but a class name that is used with oxnew, and i think the namespaced version should work for this. For example in ContentList $_sListClass is “oxcontent”, vs the table name “oxcontents”.


#3

@leofonic: Thanks for your answer. I did a second intensive code-review, and i found my mistake.

Yes, you are right.I can - and I also take - variable $_sListClass with namespaces now in my ListController. I also do the same in my model that uses this listController ($_sClassName also with namespace). BUT, in my model in the __constructor, i "init"iale the TABLE of my model, that differ in the same way like “oxcontent” and “oxcontents”. Here i´ve used in OXID4 somtimes the Variable $_sClassName because it was often the same. …

Thanks