Login   Register  
PHP Classes
elePHPant
Icontem

ActiveRecord wrapper

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP Classes blog  >  Developing scalable P...  >  All threads  >  ActiveRecord wrapper  >  (Un) Subscribe thread alerts  
Subject:ActiveRecord wrapper
Summary:Take a look at Morph for MongoDB
Messages:4
Author:Jonathan Moss
Date:2010-03-01 15:34:12
Update:2010-03-03 19:20:57
 

  1. ActiveRecord wrapper   Reply   Report abuse  
Picture of Jonathan Moss
Jonathan Moss
2010-03-01 16:10:58
Hi Cesar,

Have you seen Morph for MongoDB. It is PHP package for MongoDB with an ActiveRecord type interface making it super easy to use MongoDB with PHP.

You can find it at http://code.google.com/p/mongodb-morph/

Personally I think it is pretty good but then I did write it so I'm probably a little biased :)

However, the GridFS stream wrapper would be awesome and something I have thought about writing myself but have yet to find time to implement it.

Regards,
Jon

  2. Re: ActiveRecord wrapper   Reply   Report abuse  
Picture of Cesar D. Rodas
Cesar D. Rodas
2010-03-01 20:03:58 - In reply to message 1 from Jonathan Moss
Hello Jonathan,

I wasn't aware about MongoDB-Morph, that's why I started with my ActiveMongo project :-). I just bookmarked it to review it later today.

About the Stream Wrapper, it is always a good idea to make things simple, that's why I created a brief prototype to abstract GridFS as much as possible, and Stream Wrapper were the best option. My prototype is still alpha, just support reads right now, but I'm adding write operations, which are a bit more complex.

If this prototype works and it is well accepted by the community, I'll try to port it to C, in order to merge with PECL/Mongo drive.

Best regards,

  3. Re: ActiveRecord wrapper   Reply   Report abuse  
Picture of Rene Ausserehl
Rene Ausserehl
2010-03-03 18:05:32 - In reply to message 1 from Jonathan Moss
Ok, maybe Iam stupid, Iam new to "NoSQL/ MongoDB" But I thought it is without "int, varchar, text..." field types.

So why it uses:

class Book extends Morph_Object
{

public function __construct($id = null)
{
parent::__construct($id);
$this->addProperty(new Morph_Property_String('title'))
->addProperty(new Morph_Property_String('author'))
->addProperty(new Morph_Property_Integer('pageNumber'))
->addProperty(new Morph_Property_Date('publishedDate'));
}

}

Any (logical ) reasons for this?

  4. Re: ActiveRecord wrapper   Reply   Report abuse  
Picture of Cesar D. Rodas
Cesar D. Rodas
2010-03-03 19:20:57 - In reply to message 3 from Rene Ausserehl
Hello,

Morph is just an abstraction over MongoDB, and I don't know why it uses this sort of things.

You can use MongoDB without any abstraction, it is very amicable, or perhaps you can try my beta ActiveMongo

http://github.com/crodas/ActiveMongo/

Example of use:

http://github.com/crodas/ActiveMongo/blob/master/sample/blog ...

When this package became stable (few things are missing, in one or two days), I'll submit it here.

Best regards,