Skip to content

Instantly share code, notes, and snippets.

@lox
Created May 16, 2010 05:18
Show Gist options
  • Save lox/402685 to your computer and use it in GitHub Desktop.
Save lox/402685 to your computer and use it in GitHub Desktop.
Example code from Pheasant
<?php
/**
* A domain object using Pheasant for persistence
*/
class User extends DomainObject
{
public function __construct($firstname, $lastname)
{
$this->firstname = $firstname;
$this->lastname = $lastname;
}
private function attributes()
{
return array(
Attribute::serial('userid', array('primary'=>true)),
Attribute::string('firstname', 255),
Attribute::string('lastname', 255, array('null'=>true, 'default'=>'frank')),
);
}
private function relationships()
{
return array(
'Group' => Relationship::hasOne('Group','groupid'),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment