In this example, we are going to build the User
class. An instance of this class will represent a user in the system. Before we do that, we are going to generate some dummy user accounts in the system by running a PHP script to insert some data into a collection named users.
1. Open your text editor and put the following code in a new file:
<?php require('dbconnection.php'); $mongo = DBConnection::instantiate(); $collection = $mongo->getCollection('users'); $users = array( array( 'name' => 'Luke Skywalker', 'username' => 'jedimaster23', 'password' => md5('usetheforce'), 'birthday' => new MongoDate( strtotime('1971-09-29 00:00:00')), 'address' => array( 'town' => 'Mos Eisley', 'planet' => 'Tatooine' ) ), array( 'name' => 'Leia Organa', 'username' => 'princessleia', 'password' => md5('eviltween'), 'birthday' => new MongoDate (strtotime('1976-10-21 00:00:00')), 'address' => array( 'town' => 'Aldera', 'planet...