Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Many to Many Error
  • I'm struggling through this one, but it's beating me down more so than usual.
    This is the error message I'm getting: Assigned relationships must be an array or null, given relationship value for layout is invalid. The part that is causing the error:
    $page = new Model_Page();
    $page->layout = Model_Layout::find(\Input::post('page_layout'));
    $page->title = \Input::post('page_title');
    $page->type = 'page';
    

    My many-to-many properties:
        protected static $_many_many = array(
            'layout' => array(
                'key_from' => 'id',
                'key_through_from' => 'page_id',
                'table_through' => 'pages_layouts',
                'key_through_to' => 'layout_id',
                'models_to' => 'Website\Model_Layout',
                'key_to' => 'id',
                'cascade_save' => true,
                'cascade_delete' => false,
            )
        );
    

    Can anyone point me in the right direction.
  • craig.hoog wrote on Friday 25th of May 2012:
    I'm struggling through this one, but it's beating me down more so than usual.
    This is the error message I'm getting: Assigned relationships must be an array or null, given relationship value for layout is invalid.

    Found the solution here:
    http://fuelphp.com/forums/topics/view/4963 Was setting $page->layout = when $page->layout[] was necessary for many-to-many.

Howdy, Stranger!

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

In this Discussion