Jump to:

10842 Posts in 2512 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » GIS: GeoPoint inheritance

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1153 Views
  • Entar
    Avatar
    Community Member
    18 Posts

    GIS: GeoPoint inheritance Link to this post

    hi everybody!

    I have a strange behaviour in datamodel and property inheritance, here's what I am trying to do.

    class BaseClass extends DataObject {
       static $db = array(
          'Point' => 'GeoPoint',
          'Text' => 'Varchar'
       );
    }

    class ChildClass extends BaseClass {
       public function getCMSFields(){
          print_r($this->Point); // empty
          print_r($this->Text); // it's ok, I see this property
       }
    }

    It is simplified example of what I am trying to do. This code always return empty object. I have this object entry in db with right Point data, but it always return me object with no coordinates or any data that exist in db. any ideas?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: GIS: GeoPoint inheritance Link to this post

    Try Debug::show($this->dbObject('Point')); and see if that returns you the GeoPoint object.

  • Entar
    Avatar
    Community Member
    18 Posts

    Re: GIS: GeoPoint inheritance Link to this post

       public function getCMSFields() {   
          Debug::show($this->dbObject('Point'));
       }

    Didn't found better place for it, anyway - it shows nothing...

  • Entar
    Avatar
    Community Member
    18 Posts

    Re: GIS: GeoPoint inheritance Link to this post

    main problem is not that simple I posted before, but I think it is a cause of this:

    [User Error] GeoPoint::setValue() - Bad value '\000\000\000\000\000\000\000�����T@�����K@'

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: GIS: GeoPoint inheritance Link to this post

    Looks like a 2.3 specific bug, works fine in SilverStripe trunk - see this unit test: http://open.silverstripe.com/changeset/89142

    The 2.3 bug is in DataObject->buildSQL(), where it uses databaseFields() instead of inheritedDatabaseFields(). The logic changed a bit in trunk, and I don't think its feasible to fix something so deep in the core for a late stage release branch. I'd suggest you patch your 2.3 installation for now, or wait for 2.4

    1153 Views
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.