Created
May 16, 2010 05:18
-
-
Save lox/402685 to your computer and use it in GitHub Desktop.
Example code from Pheasant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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