eZ Community » Forums » Developer » What the persistent data dirty mean?
expandshrink

What the persistent data dirty mean?

What the persistent data dirty mean?

Wednesday 27 June 2012 5:01:58 am - 3 replies

While I look through the API of the ezpersistentobject, I saw the member variable. But I have no clue what this mean. When the data is considered dirty?

Wednesday 27 June 2012 9:18:37 am

Hi Wei,

The persistent data dirty member let you know if your fetched php object has been modified since it has been fetched. It turns to true everytime the value of an attribute is modified.

You could take a look at eZPersistentObject::sync() to understand better.

 

Regards,

Friday 29 June 2012 10:15:00 am

Yes. But the eZPersistentObject::sync() just has a few lines code which call  eZPersistentObject::store() if the data marked only.

 

I see in the API doc, some attributes like "status" use sync(), other attributes and most the existing tutorials just use store().

 

When should use sync() and when should use store() then?

Friday 29 June 2012 10:20:22 am

Hi Wei,

sync() and store() have both the same effect ( as you can see that sync() call store() ).

sync() just check that your data have been altered before calling store(), i guess it's usefull to call it to avoid useless database transaction

 

regards,

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu