Magento Forum

   
Why are isDirty / flagDirty in Varien_Object unused? 
 
sjmadsen
Jr. Member
 
Total Posts:  15
Joined:  2008-08-18
 

Why is the “dirtiness” flagging in Varien_Object unused by the low-level data setters?

I am interfacing directly with the Magento classes to import and maintain a large (~7800 categories, ~141,000 products) catalog.  Going through SOAP is not an option.  The import facility doesn’t allow me to import the category tree.

The import is working fine, but oh man is it slow.  It processes about 1.5 products per second.  I can pay this price (excruciating though it will be) for the initial import (26 hours), but for future updates, I don’t want to update a product if nothing has changed.  The dirty flags are perfect and I thought I was home free… yet they are unused.

Is it enough to hack in a call to flagDirty() in setData() and unsetData()?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Morriz
Jr. Member
 
Total Posts:  5
Joined:  2009-08-20
 

Wow, the previous post is a year old, and still no change!

I have the same problem. I am trying to test in customer_address_save_before (or customer_address_save_after, whichever one works) to see if the address has changed. I need this to unset something from the customer session.

But I have simply NO way of telling wether an object has changed in Magento. isDirty and flagDirty should have been implemented!

And if I try to work around this caveat, by comparing _data and _origData (perhaps with their dumbed down dirty test method hasDataChangedFor), I discovered that _origData wasn’t populated on either occasion :(
WTF?

How is that for making a programmers life impossible?

Oh, and btw, I also noticed that Magento does way too many object saves when there is absolutely no need to. Example:

If I click ‘checkout’ my debugger goes through a customer save with all its associated child objects being saved too. When I only request some data! Can you believe that?

Pffff, I am getting depressed here. If I don’t want to hack in core files, the only solution that’s left is to load up the address first from database, knowing that it will get loaded again later on by that core save action, and on top of all that: this whole operation will get called so many unnecessary times. I have never built something as bad and bloated like this in my life!

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShopGuy
Guru
 
Total Posts:  462
Joined:  2008-09-07
 

What debugger are you using?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Morriz
Jr. Member
 
Total Posts:  5
Joined:  2009-08-20
 

Eclipse with ZendDebugger. You?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top