Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hailwood
Created January 14, 2015 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hailwood/997ab612f157e70b48ee to your computer and use it in GitHub Desktop.
Save hailwood/997ab612f157e70b48ee to your computer and use it in GitHub Desktop.
<?php
//...
class Business extends DataObject {
//...
private static $has_one = array(
"Category" => "Category",
);
private static $has_many = array(
"Services" => "Service"
);
//...
}
//...
class Category extends DataObject {
//...
private static $has_many = array(
"Businesses" => "Business",
"Services" => "Service"
);
//...
}
//...
class Service extends DataObject {
//...
private static $has_one = array(
'Category' => 'Category'
);
private static $belongs_many_many = array(
"Businesses" => "Business",
);
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment