Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » get values from other table

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 533 Views
  • snaip
    Community Member
    180 Posts

    get values from other table Link to this post


    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

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.