Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User extends Member {
- private static $db = array(
- "FirstName" => "Text",
- "Age" => "Int",
- "Address" => "Text"
- );
- public static $has_one = array(
- 'Profile' => 'Profile'
- );
- public function onBeforeWrite()
- {
- parent::onBeforeWrite();
- if (! $this->Profile()->exists()) {
- $profile = new Profile();
- $profile->User = $this;
- $profile->write();
- $this->ProfileID = $profile->ID
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement