I am working on a Craft plugin.

I have a main entities are 'Courses' and 'Entries'. If I click on an Entries in the CMS there is an option to select and associated 'Course'.

In my controller I can get a Course as follows:

$course = craft()->entries->getEntryById($variables['pathId']);

So far so good, but now I want to get all related 'Entries', so I do the following:


This gives the following error:

Property "Craft\EntryModel.entries" is not defined.  

What am I doing wrong? Clearly the two are related so why isn't this method working?

2 Answers 2


I think this works but is it an acceptable solution:

$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section = 'checkin';

$criteria->relatedTo = array(
     'targetElement' => $entry,
     'field' => $field

$checkin = craft()->elements->findElements($criteria);

I think you're looking for

$criteria->with = array('fieldHandle');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.