php - Datamapper and CI: is not a valid parent relationship -
i have 2 models tables need relate, campus:
class campus extends datamapper { var $table='campi'; var $has_many=array('boleto'); function __construct() { parent::__construct(); } }
and boleto:
class boleto extends datamapper { var $table='boletos'; var $has_one=array('campus'); function __construct(){ parent::__construct(); } }
i have been working these tables 5 months, have relation table:
| id | boleto_id | campus_id |
everything ok, recently, every time need make includes relation got error message:
datamapper error: 'boleto' not valid parent relationship campus. relationships configured correctly?
do know what's happening? can't find error. strange that, said, working.
thanks in advance!
table boletos
:
| id | folio |
table campi
:
| id | nombre_campus |
table boletos_campi
:
| id | boleto_id | campus_id |
i'm trying code (as working before have relation saved):
$b = new boleto(); $b->where('id',20114)->get(); $b->campus->get();
Comments
Post a Comment