Can't get_record!

I'm trying to retrieve an exhibit page by calling get_record('ExhibitPage', array('title' => $string)); but it doesn't bring back the correct page, it reverts to the About page for the exhibit (which, as I understand it, is the behavior if the $params array is NULL.)

Likewise, get_db()->getTable('ExhibitPage')->findBy(array('id' => 1)); does not return the exhibit page with the id of 1, but
get_db()->getTable('ExhibitPage')->find(1); does.

Any advice?

There are a couple interrelated things happening here.

First, it looks like the ExhibitPage table isn't set up to filter results by title or id. Thus, it behaves just as you say, as if $params is NULL.

Second, findBy always returns an array, but because of the first thing above it will be an array that includes lots of things you don't want.

find(), on the other hand, is built to return a single object with that id.

There are a couple options.

One, is to add the following to plugins/ExhibitBuilder/models/Table/ExhibitPage.php

At line 40 or so, at the beginning of applySearchFilters(), add

parent::applySearchFilters($select, $params);

That would produce the expected results at the cost of changing core files. Then again, I'll be proposing that we make that change for future releases anyway.

The other option is to use the <model>_browse_sql hook to make a similar change. Something like this (untested):

if (isset($params['title'])) {
    $select->where('exhibit_pages.title = ?', $title);