can anybody help with this?
I've go a front end complextable (or dataobjectmanager - either is fine) and it lists my dataobjects fine, but when i click them or try to add a new one it just ends with "page not found"
here's my code:
<?php
class Rates extends DataObject {
public static $db = array(
"PricePerNight" => "Currency",
"dateStart" => "Date",
"dateEnd" => "Date"
);
public static $has_one = array(
"Apartment" => "Apartment"
);
public static $has_many = array(
);
public function getCMSFields_forPopup() {
return new FieldSet(
new TextField('PricePerNight'),
new DatePickerField ('dateStart','Date of arrival'),
new DatePickerField ('dateEnd','Date of departure')
);
}
}
*********************************************
function RatesForm(){
$Apartment = $this->getApartment();
$Manager = new ComplexTableField(
$this,
'Rates',
'Rates',
array('dateStart' => 'dateStart'),
'getCMSFields_forPopup',
'ApartmentID = ' . $Apartment->ID
);
$Manager->setParentClass('Rates');
$Manager->setPermissions(array("show","edit", "add"));
$fields = new FieldSet(
new HiddenField('ID', ''),
$Manager
);
return new Form($this, 'RatesForm', $fields, new FieldSet());
}
I'm guessing the issue is because i'm generating the form on an external page type to where the "Rates" are initially managed. so is it to do with the controllers?
I think the problem may lie here:
$Manager = new ComplexTableField(
$this,
Does the $this need to be something else?
I have the following relationships.
"Apartments" are dataobjects - they $has_many "Rates"
"Rates" are dataobjects - they $has_one "Apartment"
And im tryng to have a form that loads on my front end "edit" page with a URL like this: mysite.com/account/your-listings/rates/apartment-name
It all shows up fine in the front end, and ONLY the rates that apply to that Apartment appear, it's just I cant click/edit/delete them.
thanks in advance for your help!