Subject: $has_many does not work
0 down vote favorite
I'm developing a web app(PHP) with an already database(MySQL) existing. I'm using ActiveRecord ORM and I have some issue with one-to-many relationship.
Models:http://pastie.org/5104897 (orden.php)
http://pastie.org/5104905 (dato_orden.php)
http://pastie.org/5104908 (Tables)
Basically one "orden" has many "datosorden" and one "datoorden" belongs to one "orden". When I try:
var_dump(Orden::find(1)->datos_ordenes); // NULL <- Does not work.var_dump(DatoOrden::find(1)->orden1->idorden); // string(1) "1" <- Works!
Why $has_many does not works but $belongs_to does it?
June 27 2010
April 16, 2013
Subject: $has_many does not work
0 down vote favorite
I'm developing a web app(PHP) with an already database(MySQL) existing. I'm using ActiveRecord ORM and I have some issue with one-to-many relationship.
Models:
http://pastie.org/5104897 (orden.php)
http://pastie.org/5104905 (dato_orden.php)
http://pastie.org/5104908 (Tables)
Basically one "orden" has many "datosorden" and one "datoorden" belongs to one "orden". When I try:
var_dump(Orden::find(1)->datos_ordenes); // NULL <- Does not work.
var_dump(DatoOrden::find(1)->orden1->idorden); // string(1) "1" <- Works!
Why $has_many does not works but $belongs_to does it?