Interesting, Controller::curr() gets me my InvoiceAdmin object (which extends LeftAndMain).
Basically what I'm trying to do is I have a Company DataObject...
class Company extends DataObject {
static $db = array(
'Title' => 'Varchar(100)',
'Address1' => 'Varchar(255)',
);
static $has_many = array(
'Invoices' => 'Invoice',
);
public function getCMSFields() {
//...
$invoices = new DataObjectManager(
$this,
'Invoices',
'Invoice',
array(
),
'getCMSFields_forPopup'
);
//...
}
}
When the popup is called I want to populate the Company's address as the default value into the Invoice Popup...
class Invoice extends DataObject {
static $db = array(
// To
'ToTitle' => 'Varchar(100)',
'ToAddress1' => 'Varchar(255)',
);
public function populateDefaults() {
// Can't get controller here
// Controller:curr() returns an InvoiceAdmin object
}
public function getRequirementsForPopup($dom) {
// Other option is to get controller here
// Controller:curr() returns an InvoiceAdmin object
// I want the invoice address to default to the Company's address
/*
$company = $dom->controller;
if ($company) {
$this->ToTitle = $company->Title;
$this->ToAddress1 = $company->Address1;
}
*/
}
}
Can you think of any other way to get access to my Company object before the popup is instantiated?
Thanks,
Gene