dready92 / PHP-on-Couch

Data Access Library to access a CouchDB server with PHP.

Home Page:http://dready.byethost31.com/index.php/display/view/192

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto-record in the couchDocument can be frustrating.

MrTrick opened this issue · comments

__set() calls record() every time a property is changed. This behavior might be undesired - could it be made configurable?

(I would prefer to manually save the document, so I've removed the record() call from set, and changed __set to call setOne.)

Perhaps a static flag '$auto_record', and a way to change it?

Hello, and thanks for your feedback.
Did you see that you can call $doc->set( array ('var1'=>'something','var2'=>'another thing')), and that will update all the array properties in one go ? Can this feature meet your needs ?

That is a nice feature.
My dilemma is that I'm writing an abstraction library for the database so that other programmers can use it without knowing what views, revs, other couchdb concepts are. I can't foresee their usage patterns, and with __set always calling record it could result in lots more database updates than necessary.
For each their own, I suppose. :-)