Great, thank you very much, Robert, for the details! I think, I've got it now :-)
TJ Von: [email protected] [mailto:[email protected]] Im Auftrag von Robert Rosendahl Gesendet: Mittwoch, 24. Oktober 2012 01:46 An: [email protected] Betreff: Re: [oxid-dev-general] regarding diamond problem (report #4638) Hi, if you extend several view classes with the same module, then this will probably work in most cases, because only one view class is instantiated (there's only one view specified by the cl=... parameter). When extending core classes, and more than one of those gets instantiated, then you will probably run into problems because of the "magic" parent classes (like Alfonsas wrote in the bugtracker - I'm partly repeating it here so the mailing list audience doesn't have to cross-check the bugtracker ;-) ). So if you've got a module class "myview" and register it to several views (e.g. alist and details): class myview extends myview_parent { ... } then OXID eShop will resolve this to create a class myview_parent that extends the view that is being requested by the "cl" parameter. So if you call index.php?cl=alist then this class will look like this: class myview_parent extends alist {} And if you call index.php?cl=details then it will look like this: class myview_parent extends details {} This is why it will not cause problems with views in most cases. When using the same module class to extend two core classes that might get used at the same time, then you're bound for trouble. Let's say your module "mycore" extends oxarticle and oxcategory: class mycore extends mycore_parent { ... } If oxcategory gets instantiated first then the parent class will be created like this: class mycore_parent extends oxcategory {} If oxarticle gets instantiated later, then the parent class won't change because it has already been created. This will lead to your product being derived from oxcategory and not oxarticle: $oProduct = oxNew('oxArticle'); // mycore extends mycore_parent extends oxcategory (and not oxarticle) In the bugtracker, you wrote that you got some sql error. I haven't tried this, but I suspect that this will happen because oxarticlelist will make the shop use the oxarticles database table, while your product class is derived from oxcategory and that will use columns from oxcategories in any generated queries. So, in the end, you can usually get away with a single module extending several views (in fact some of the wysiwyg editor modules for the admin do this), but you shouldn't extend different core classes (or anything except views) with a single module. Best regards, Robert -----Ursprüngliche Daten----- Datum: 23.10.2012 15:44:10 Von: Jungclaus, Tobias <[email protected]<mailto:[email protected]>> An: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> Betreff: [oxid-dev-general] regarding diamond problem (report #4638) Vorgang: T-MTI0VL83K4-56 Hi devs, https://bugs.oxid-esales.com/view.php?id=4638 Thank you for the detailed explanations - that is really interesting! However in another module it works fine: I extend all five checkout-view-classes with the same class. In this class I extend the getTitle function (calling parent), and all works fine. What may be the difference here? ( I just want to be sure, that our current checkout doesnt promptly vanish in a puff of logic ;-) ) TJ ________________________________ _______________________________________________ dev-general mailing list [email protected]<mailto:[email protected]> http://dir.gmane.org/gmane.comp.php.oxid.general
_______________________________________________ dev-general mailing list [email protected] http://dir.gmane.org/gmane.comp.php.oxid.general
