21287 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 188 Views |
-
many_many relation with custom member class

6 May 2012 at 1:46pm Last edited: 6 May 2012 10:18pm
Hi Everyone
I want to built Reregistration system for Trips that planned in my community club. So, I created the TripHolder
<?php
/**
* Defines the TripHolder page type
*/
class TripHolder extends Page {
static $db = array(
);
static $has_one = array(
);static $allowed_children = array('Trip');
}class TripHolder_Controller extends Page_Controller {
}
?>And also the Trip page:
<?php
/**
* Trip Page
*/
class Trip extends Page{
static $db = array(
'Departure' => 'Date',
'Return' => 'Date',
'Location' => 'Text',
'Seats' => 'Int'
);static $has_one = array(
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Departure','Departure Date of the Trip (for example: 20/12/2010)'), 'Content');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
$fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Return','Return Date of the Trip (for example: 20/12/2010)'), 'Content');$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');$fields->addFieldToTab('Root.Content.Main', new TextField('Location','The Trip Location'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new NumericField('Seats','The Available Seats on the Trip'), 'Content');return $fields;
}}
class Trip_Controller extends Page_Controller {
}?>
And, I extended the member class:
<?php
class MyMember extends Member {
static $db = array(
"Mobile" => "Int",
"Institute" => "Text",
"City" => "Text",
"Institute" => "Text",
);}
?>
So, My question is how can I make the many_many relation between MyMember class and Trip page and then member can register in a Trip.
-
Re: many_many relation with custom member class

7 May 2012 at 6:56pm
Is it wrong way to have relation between page and member class?
I want only member can register for a trip.
Please let me know, if you didn't get my question.
| 188 Views | ||
|
Page:
1
|
Go to Top |

