Skip to content

Instantly share code, notes, and snippets.

@squidge
Created May 30, 2013 06:03
Show Gist options
  • Save squidge/5675967 to your computer and use it in GitHub Desktop.
Save squidge/5675967 to your computer and use it in GitHub Desktop.
mongodm models
class Base extends Model {
static $config = "default";
}
class User extends Base {
static $collection = "user";
protected static $attrs = array(
'first_name' => array( 'type' => 'string' ),
'last_name' => array( 'type' => 'string' ),
'contacts' => array( 'model' => 'App\Models\Contact', ' type' => 'references' )
);
}
class Contact extends Base {
static $collection = 'contact';
}
---- have also tried ---
class Contact extends Base {
static $collection = 'contact';
protected static $attrs = array(
'user' => array( 'model' => 'App\Models\User', ' type' => 'reference' )
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment