Hi Tim,

Thanks a lot, disabling the field caching for the respective class solved my 
problem. It seems to result in an additional cache file being created for the 
respective object and every view that uses this object (e.g. 
oxeec_fieldnames_oxcategories_start_i18n.txt). In the cache file all the fields 
are mentioned that are used to render the respective view.

I still don’t understand, why lazy loading was implemented this way and why I 
have to disable caching to produce additional cache files that result in 
another feature working. In my opinion, lazy loading could be implemented 
non-optional, with a set of default fields for each db object. Every additional 
field gets loaded on demand. Additionally, this could be optimized the way it 
seems to be using a cache file that stores all the fields in addition to the 
default ones that should be loaded when a certain view is rendered.
Maybe one of the core devs could say a word or two on this topic and whether 
this could be considered a bug in the implementation or just a small design 
flaw.

Thanks a lot for your help!

Best regards
Dipl.-Ing. (FH) Michael Zender
Development eCommerce
Technical Project Lead
MOS-TANGRAM AG
Wohlerstrasse 2
CH-5623 Boswil
Phone: +41 (0)56 677 82 20
Fax: +41 (0)56 677 82 99
E-Mail: [email protected]<mailto:[email protected]>
Internet: http://www.mos-tangram.com<http://www.mos-tangarm.com/>

Von: [email protected] 
[mailto:[email protected]] Im Auftrag von Tim Aniol
Gesendet: Mittwoch, 23. Januar 2013 12:00
An: [email protected]
Betreff: Re: [oxid-dev-general] Lazy Loading

Hi Michael,

we ran into the same problem with oxcategory and category descriptions for 
sub-categories. This code snippet works fine for us:


/**
* Module smx_oxcategory
* Activate lazyloading to get custom db fields
*/
public function __construct()
{
                $this->_blUseLazyLoading = true;
                self::$_blDisableFieldCaching[get_class($this)] = true;
                parent::__construct();
}


Mit freundlichen Grüßen

Tim Aniol
Softwareentwickler

*************************************
shoptimax GmbH
Guntherstraße 45a
90461 Nürnberg
Tel    (09 11) 2 55 66 - 10
Fax    (09 11) 2 55 66 - 29
eMail  [email protected]<mailto:[email protected]>
Web    www.shoptimax.de<http://www.shoptimax.de>
*************************************
Geschäftsführung: Friedrich Schreieck
Ust.-IdNr.: DE 814340642
Amtsgericht Nürnberg HRB 21703

Von: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] Im Auftrag von Michael Zender
Gesendet: Mittwoch, 23. Januar 2013 11:55
An: [email protected]<mailto:[email protected]>
Betreff: Re: [oxid-dev-general] Lazy Loading

Hi Björn,

Thank you for your quick answer!!

I already tried, what you suggested. Sorry, I did not mention that in my 
original E-Mail.

I created a module for oxCategory and set oxCategory::$_blUseLazyLoading to 
true in the overridden init() method. Unfortunately, this does not seem to have 
any effect on my problem.

Best regards
Dipl.-Ing. (FH) Michael Zender
Development eCommerce
Technical Project Lead
MOS-TANGRAM AG
Wohlerstrasse 2
CH-5623 Boswil
Phone: +41 (0)56 677 82 20
Fax: +41 (0)56 677 82 99
E-Mail: [email protected]<mailto:[email protected]>
Internet: http://www.mos-tangram.com<http://www.mos-tangarm.com/>

Von: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] Im Auftrag von Lange, Björn
Gesendet: Mittwoch, 23. Januar 2013 11:40
An: [email protected]<mailto:[email protected]>
Betreff: Re: [oxid-dev-general] Lazy Loading

Hi Michael,

2013/1/23 Michael Zender 
<[email protected]<mailto:[email protected]>>
I investigated this issue a little further and discovered, that the 
$oxcmp_categories object is constructed using the method 
oxCategoryList::buildTree() which does NOT load the oxpromoicon field for very 
category. BUT, as far as my understanding of lazy loading goes, the respective 
field should be loaded automatically, when it is accessed, but not already 
loaded.
I would use a module till now for this use case.
I hope someone can elaborate a little bit on this topic, how the lazy loading 
feature in OXID works and how one has to use it. Also, for a scenario like 
mine, what would be the best practice to get the URL I’m interested in.
Lazy Loading works through the magical getter in the oxbase class. If the 
property $this->_blUseLazyLoading is true and the requested field is a table 
field of the objects core table, the value is loaded (either from the cache or 
the database). Take a look into oxarticle. _blUseLazyLoading is true by 
default. But in oxcategory, it is false by default. Try to change the value and 
i think (without further tests), it should work.

Regards,
Björn

--

_________________________________
WBL Konzept GmbH
Björn Simon Lange
Geschäftsführender Gesellschafter

Bilker Straße 34
40213 Düsseldorf

Telefon: 0211 942 120 31 | Fax:  0211 942 120 32
www.wbl-konzept.de<http://www.wbl-konzept.de/> | 
www.facebook.com/wbl.konzept<http://www.facebook.com/wbl.konzept> | 
[email protected]<mailto:[email protected]>
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general

Reply via email to