Express as Express Attribute

Permalink
Hey All,

Sorry if this is a repost. I've looked quite a bit, but haven't found this addressed.

SETUP
I have an "Event" express object, being used to populate data throughout my site. It's attributes are mostly of the Text and Image type, but I also have another express object - "Location", with it's own data like "Address" and "Venue Name".

I have an express block, where I would like to display the various attributes of an "Event", using something like:

$eID = $entry->getID();
$exEntry = Express::getEntry($eID);
if($exEntry->getEventImage() ){
    $imageUrl =  $exEntry->getEventPrimaryImage()->getUrl();
  }
// Works great!


Because "Location" was added as an Attribute, and NOT an Association, I am getting an error, "Call to a member function getLocationName() on null" when I try to run the following:
if ($exEntry->getEventLocation()) {  
   $location = $exEntry->getLocation()->getLocationName();
 }


I have confirmed that this does not fail when the "Location" express object is added as an association.

QUESTION
Is there an elegant (or even inelegant way) to retrieve the attributes of express objects that are attributes (not associations) of other express objects.

I have close to 50 objects. I would prefer not to go back in and have to add new association, if I don't have to.

Feel free to let me know if I can add anything further. I've pull my hair for a few hours on this one, already.

Thanks,
E

View Replies: