phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.78k stars 1.96k forks source link

Any plan about support PHP MongoDB Driver? #11156

Closed gai00 closed 5 years ago

gai00 commented 8 years ago

PHP PECL "mongo" is deprecated. Ref: http://php.net/manual/en/book.mongo.php

The newer extension is PECL "mongodb" Ref: http://php.net/manual/en/set.mongodb.php

Interfaces has huge differences.

sergeyklay commented 8 years ago

In general it is necessary to conduct laborious of refactoring. You'd be able to do it? :)

virgofx commented 8 years ago

+1

gai00 commented 8 years ago

I don't think I can do that...Orz

hope it can be made by someone.

fizzka commented 8 years ago

+1 interface has minor differences

sergeyklay commented 8 years ago

@fizzka Can you please do PR?

fizzka commented 8 years ago

sorry, but I don't think I can do smtng good in zep =)

Ajibola commented 8 years ago

+1

memmaker commented 8 years ago

+1

Evgeny- commented 8 years ago

+1

ddonng commented 8 years ago

Hope +1

ulfims commented 8 years ago

If i'm intersted to implement new driver, how can I do?

ulfims commented 8 years ago

Or someone already did this?

sergeyklay commented 8 years ago

I propose to do it first for Incubator. We will be able to evaluate his work and usefulness. Will be able to test and see thin places. Then we can port it to the Phalcon Core

blocklogic-au commented 8 years ago

Im happy to look at putting in some time to this. Has anyone made a start anywhere?

sergeyklay commented 8 years ago

@tigerstrikemedia It seems to me nobody

blocklogic-au commented 8 years ago

@sergeyklay looks like it's from scratch then ;)

blocklogic-au commented 8 years ago

@sergeyklay

This is deeper than I thought.

What sort of performance gains are we talking to essentially build a trimmed down version of the mongo PHP library eventually ported into zephir?

Short of requiring that library which seems quite out of line with the phalcon system, that is what would be required to support the new MongoDB extension in the ODM system of phalcon.

perhaps It would even be better at that stage to start on a full DB Adapter for MongoDB, it would seem that the majority of that sort of functionality is what mongo decided to strip out of the PHP extension.

sergeyklay commented 8 years ago

This is deeper than I thought.

Yeah, indeed. But as @fizzka said

interface has minor differences

;)

It seems to me, we have to use current stable Mongodb API. This is really important. Of course, it's actually more complicated than it seems at first glance. But due to the fact that Phalcon is PHP extension it make sense. And yes, implementation of this feature implies compliance current Phalcon API and BC

blocklogic-au commented 8 years ago

@sergeyklay

Interface has minor differences, but pulling that interface into phalcon requires recreating the wheel as that is what mongo split out to a PHP library rather than keeping it in the extension. Seems a bit like fighting the tide to me, but I think that Phalcon has been a bit like that the whole way along.

Ill pull what will essentially be a copy of the Mongo PHP library into a MongoDB Adapter in the incubator tonight / tomorrow and try to get a model adapter running from that.

Does that make sense?

blocklogic-au commented 8 years ago

Just added a pull request to the incubator.

https://github.com/phalcon/incubator/pull/625

blocklogic-au commented 8 years ago

@sergeyklay

The travis builds are failing from code styling issues do you know of anywhere I can get a PHPStorm code style config for this?

duythien commented 8 years ago

@tigerstrikemedia Because Phalcon incubator use PSR2 styles, so you can use this library to fix your styles code

curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
php phpcbf.phar --standard=PSR2  Library/Phalcon/Db/Adapter/MongoDB
blocklogic-au commented 8 years ago

We now have a very early version of the adapter (Phalcon\DB\Adapter\MongoDB) and collection (Phalcon\Mvc\MongoCollection) in the 2.1 branch of the incubator anyone who wants to test and let me know what breaks i'd be happy to work through any issues.

ohmcoe commented 8 years ago

+1

Hope for PHP7.

sergeyklay commented 8 years ago

https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Db/Adapter

elias1710 commented 7 years ago

+1

Jurigag commented 7 years ago

@belgrid it's already implemented in incubator. The code in core is for php 5, we can't make same class supporiting both php 5 and php 7 without some bad code. It's easier to have seperated class.

afbora commented 6 years ago

+1

cmeheut commented 6 years ago

for Mongo <= 3.5 we can use an adapter (I use https://github.com/alcaeus/mongo-php-adapter) But it's not working anymore for 3.6: The 'cursor' option is required, except for aggregate with the explain argument It seems that using the new PHP lib would be the best way

Jurigag commented 6 years ago

@cmeheut there is adapter in incubator already, not sure which exactly mongo versions it support.

simpleadm commented 6 years ago

+1

DmytroDiachuk commented 6 years ago

+1 I believe in it ;)

niden commented 5 years ago

Closing in favor of #13855. Will revisit if the community votes for it, or in later versions.

fizzka commented 5 years ago

hi guys what about https://github.com/alcaeus/mongo-php-adapter ? it looks easy to say "install this, while we reinventing new solution for new driver"? any thoughts?

niden commented 5 years ago

@fizzka There is already work underway by one of the members of the community to port the latest Mongo driver to the Collection class. That is one of the last issues we have in our v4 project

https://github.com/phalcon/cphalcon/projects/3

Jeckerson commented 3 years ago

Implemented as separate package - https://github.com/phalcon/incubator-mongodb