getting null from Editor.php:_find_field()

getting null from Editor.php:_find_field()

johnugajohnuga Posts: 16Questions: 7Answers: 0

in the _find_field method, I am passing in:

string(32) "t_daily_schedule.session_name_id"
string(2) "db"

This function returns null. It is called from _insert_or_update():

$field = $this->_find_field( $parentLink, 'db' );
// xxx continue if not found?

Since null is not checked here, I eventually get this PHP message:

Fatal error: Call to a member function val() on a non-object in /var/www/html/php/lib/Editor/Editor.php on this line:

$where = array( $childLink => $field->val('set', $this->_formData) );

My PHP code does pass in valid field names:

->leftJoin('t_sessions', 't_sessions.id', '=', 't_daily_schedule.session_name_id')

Any ideas on what may be happening?

Thanks,
-John

This question has an accepted answers - jump to answer

Answers

  • johnugajohnuga Posts: 16Questions: 7Answers: 0
    edited June 2014

    I figured this out.
    If you see this error, you are not including all of the needed:

    ->field( Field::inst( 'sql_field')

    in you php code: $data = Editor::inst()...

    If you are doing joins with ->leftJoin(), you need to list sql columns from both tables. This is what I was missing.

    I wish the returned error message was better.

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    Hi,

    Thanks for the feedback and good to hear you found a solution for this. I'll look at improving the error message for this situation.

    Allan

This discussion has been closed.