-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auth support and replica sets almost ready, better configuration for …
…connections (requires PHP 5.3+)
- Loading branch information
Showing
14 changed files
with
325 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
MongoModel | ||
---------- | ||
|
||
MongoModel is a simple set of object wrappers classes for storing PHP objects in MongoDB. | ||
|
||
MongoModel is comprised of two major classes (in the lib directory). | ||
* MongoEntity: the base class with all of the CRUD operations from which other classes will inherit. | ||
* MongoFactory: a simple factory class for loading an array of MongoEntity objects. Can be inherited to provide a specific factory for you specific needs. | ||
|
||
Basic Usage | ||
=========== | ||
|
||
class User extends MongoEntity { | ||
|
||
protected static $_mongo_database = "users"; # Effectively the database name | ||
protected static $_mongo_collection = "user"; # Effectively the table name | ||
|
||
} | ||
|
||
This allows you to store objects in the 'users' database and the 'user' collection. | ||
|
||
$user = new User(); | ||
|
||
$user_data = array("first_name" => "Gates", "last_name" => "VP"); | ||
$user = new User($user_data); | ||
if($user->save()){ | ||
print("saved the user"); | ||
} | ||
|
||
Shorten field names | ||
=================== | ||
.... | ||
|
||
More details to come. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.