Bug Report #4420

ORM with belongs_to causes error when setting it to NULL

Added by Adam Radwon 4 months ago. Updated 4 months ago.

Status:New Start date:01/27/2012
Priority:Normal Due date:
Assignee:Adam Radwon % Done:

0%

Category:-
Target version:Kohana v3.x - v3.2.1
Resolution: Points:1

Description

Reported in the forums: http://forum.kohanaframework.org/discussion/10125/

Setting a belongs_to relationship to NULL results in an error because the pk() method is being called on $value while it is NULL.

Kohana_ORM::set() (orm.php line 675):

$this->_object[$this->_belongs_to[$column]['foreign_key']] = $value->pk();

Also available in: Atom PDF