cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

Deprecated: MongoCollection::save()

Open tanagorns opened this issue 12 years ago • 6 comments

I used multiple findFirst and save() at the same time.

show error

 Deprecated: MongoCollection::save(): The 'safe' option is deprecated, please use 'w' instead

tanagorns avatar Jan 10 '14 18:01 tanagorns

This has to do with the version of the mongo client being used. They will have to put conditionals in to check the client version.

moderndeveloperllc avatar Jan 10 '14 19:01 moderndeveloperllc

https://github.com/phalcon/cphalcon/blob/644be915f6bbc3c24165f6948b24da19f152aa4e/ext/mvc/collection.c#L1410

this line should be change to "w"

I had to see the other framework (eg. kohana) https://github.com/tchemineau/kohana-mongodb/commit/b3366f71b22dc1af1572302573f37b8a94a42e6d

tanagorns avatar Jan 10 '14 19:01 tanagorns

I believe we do use 'w' instead of 'safe', at least in 1.3.0: https://github.com/phalcon/cphalcon/blob/1.3.0/ext/mvc/collection.c#L1491

ghost avatar Jan 12 '14 23:01 ghost

Submitted PR for 1.2.5: #1797

ghost avatar Jan 13 '14 00:01 ghost

thank for resolve my issue

I've finding the code at all line in collection.c, I found the same issue https://github.com/phalcon/cphalcon/blob/1.3.0/ext/mvc/collection.c#L2016

referrence http://www.php.net/manual/en/mongocollection.remove.php

tanagorns avatar Jan 13 '14 02:01 tanagorns

Fix submitted

ghost avatar Jan 13 '14 02:01 ghost