I have had this problem plenty of times over the last couple of years and haven't been able to understand why. For example I create a dataobject called Technology and add a few variables into the database. When I try to access any of them from other functions or from templates in the database by calling $this->URLSegment or $this->TechnologyPublisher I just get nothing. No error it seems that it can't see them at all.
lass Technology extends DataObject
{
static $db = array (
'Type' => 'Text'
, 'URLSegment' => 'Text'
, 'TechnologyPublisher' => 'Text'
, 'TechnologyCertification' => 'Text'
, 'TechnologyDescription' => 'Text'
so I tried other methods such as the below
Debug::show($this->ID);
Debug::show($this->dataRecord->TechnologyPublisher);
Debug::show($this->getField("TechnologyPublisher"));
Debug::show($this->dboject("TechnologyPublisher"));
but always nothing. I have always had to resort to calling the object from the db by
$area = DataObject::get_by_id('Technology',$id);
then I can do $area->TechnologyPublisher
but this is really frustrating as it seems like I am creating unnecessary work for myself and SS but I really cant see any problem I have created. any ideas?
thanks
Will