Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

get values from other table

Go to End



Community Member, 181 Posts

31 July 2009 at 7:01am


i don't know how to explain so i will say everything from start:

polish => english translation:
Obiekty > Object
Strona > Page

my ObcjecPage.php to adding objects

class ObiektyPage extends Strona {
   	static $db = array(
                'Text' => 'text',
   		'Lat' => 'Varchar(50)',
   		'Lng' => 'Varchar(50)'
   	static $has_one = array(

	function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields->addFieldToTab("Root.Content.Main", new TextareaField("Text", "Text:",4),"Content");
		$fields->addFieldToTab("Root.Content.coordinates", new TextField("Lat", "Lat:"));
		$fields->addFieldToTab("Root.Content.coordinates", new TextField("Lng", "Lng:"));
		return $fields;

class ObiektyPage_Controller extends Strona_Controller {

my DataObjectManager

class Obiekty extends DataObject
	static $db = array (
		'Nazwa' => 'Text',
		'Obiekt' => 'Text'
	static $has_one = array (
		'TrasyPage' => 'TrasyPage'
	public function getCMSFields_forPopup() {
   		$stuff = DataObject::get("ObiektyPage");
      		$map = $stuff? $stuff->toDropdownMap():array();
		return new FieldSet(
			new TextField('Nazwa'),
			new DropdownField('Obiekt','Obiekt',$map)	

and now when i add Object to the TrasaPage by DropdownField i also want to get coordinates $Lat and $Lng of chosed object but i don't know how