Esempio n. 1
0
  | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;    |
  | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND     |
  | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT      |
  | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS   |
  | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE                     |
  +---------------------------------------------------------------------------------+
  | Authors: César Rodas <*****@*****.**>                                           |
  +---------------------------------------------------------------------------------+
*/
require "../../lib/ActiveMongo.php";
require "Post.php";
require "Author.php";
ActiveMongo::connect("activemongo_blog");
/* delete collections */
PostModel::drop();
AuthorModel::drop();
/* This should be done just once */
ActiveMongo::install();
/* Create a new author
 * The property country is not defined
 * as an AuthorModel property, but it will
 * be saved. 
 */
$author = new AuthorModel();
$author->username = "******";
$author->name = "Cesar Rodas";
$author->country = "PY";
$author->save();
/* Add one blog post */
$post = new PostModel();
$post->uri = "/hello-world";