PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Bartlomiej Rudzki   EVDB   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: EVDB
Store and retrieve objects in MongoDB databases
Author: By
Last change:
Date: 13 years ago
Size: 415 bytes
 

Contents

Class file image Download
<?php

require_once('EVDB.class.php');

$user = EVDB::findUserByLogin('foo');
if (!
$user instanceof EVDBObject) {
   
$user = EVDB::create('User');
   
$user->login = 'foo';
   
$user->views = 5; // notice, that "views" property is not the part of the original schema
}
$user->views++;
// onBeforeSave()
$user->save();
// onAfterSave()

echo $user->getViews(); // see plugins/EVDBUserPlugin.class.php