I have 2 models from tables I need to 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 with these tables 5 months, even have the relation table:
| id | boleto_id | campus_id |
Everything was ok, but recently, every time I need to make something that includes that relation I got this error message:
DataMapper Error: 'boleto' is not a valid parent relationship for Campus. Are your relationships configured correctly?
Do somebody know what's happening? I can't find the error. The strange is that, as I said, it was working.
Thanks in advance!
Table boletos
:
| id | folio |
Table campi
:
| id | nombre_campus |
Table boletos_campi
:
| id | boleto_id | campus_id |
I'm trying with this code (as it was working before I already have the relation saved):
$b = new Boleto();
$b->where('id',20114)->get();
$b->campus->get();