Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Has Many not working properly
  • This is my first experience with FuelPHP, so I'm not sure if I am doing something wrong. I have a Forum model which has multiple boards, these relations are mapped using "has many" on the forum and "belongs to" on the boards. All tables are set up correctly and the relation is working, but i can't access the boards from my forum model. When dumping the Forum model the array of boards is NULL:
    object(Model_Forum)#23 (8) {
      ["boards"]=>
      NULL
      ["_is_new":"Orm\Model":private]=>
    

    However when looking at the other fields of the model, the relationship is clearly working:
     ["_data_relations":"Orm\Model":private]=>
      array(1) {
        ["boards"]=>
        array(1) {
          [1]=>
          object(Model_Board)#24 (7) {
    

    Any help would be appreciated.
  • I think you added a "board" property, after which that's what is returned when requesting $forum->boards instead of __get() catching the request and returning the relation data.
  • Thanks for the quick reply. It was indeed a typo in one of my models.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion