mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
Aded initial test modeladmin
This commit is contained in:
parent
32730154e1
commit
ebca093fd7
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Set up TestModelAdmin
|
||||
Director::addRules(100, array(
|
||||
'admin/test' => 'TestModelAdmin',
|
||||
));
|
||||
LeftAndMain::add_menu_item('test', 'Test ModelAdmin', 'admin/test', 'TestModelAdmin');
|
16
code/control/TestModelAdmin.php
Normal file
16
code/control/TestModelAdmin.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class TestModelAdmin extends ModelAdmin {
|
||||
protected static $managed_models = array(
|
||||
"Client",
|
||||
"Contact",
|
||||
"Project",
|
||||
"Developer",
|
||||
);
|
||||
|
||||
function Link() {
|
||||
return 'admin/test';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
15
code/model/Client.php
Normal file
15
code/model/Client.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class Client extends DataObject {
|
||||
static $db = array(
|
||||
"Name" => "Varchar",
|
||||
);
|
||||
static $many_many = array(
|
||||
"Contacts" => "Contact",
|
||||
);
|
||||
static $belongs_many_many = array(
|
||||
"Projects" => "Project",
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
14
code/model/Contact.php
Normal file
14
code/model/Contact.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class Contact extends DataObject {
|
||||
static $db = array(
|
||||
"FirstName" => "Varchar",
|
||||
"Surname" => "Varchar",
|
||||
"Email" => "Varchar",
|
||||
);
|
||||
static $belongs_many_many = array(
|
||||
"Clients" => "Client",
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
15
code/model/Developer.php
Normal file
15
code/model/Developer.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class Developer extends DataObject {
|
||||
static $db = array(
|
||||
"FirstName" => "Varchar",
|
||||
"Surname" => "Varchar",
|
||||
"Email" => "Varchar",
|
||||
"Username" => "Varchar",
|
||||
);
|
||||
static $belongs_many_many = array(
|
||||
"Projects" => "Project",
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
13
code/model/Project.php
Normal file
13
code/model/Project.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class Project extends DataObject {
|
||||
static $db = array(
|
||||
"Name" => "Varchar",
|
||||
);
|
||||
static $many_many = array(
|
||||
"Clients" => "Client",
|
||||
"Developers" => "Developer",
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user