Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Nested set and relations
  • As I see in docs section 'NestedSets Model' ( it says:
    'The model is then set up like a normal ORM model, including any relations
    or other properties that you wish to use.'
    But I see in example you did not set primary key.

    So in fact, with version 1.7.3 I got:
    1)  Warning - in_array() expects parameter 2 to be array, string given in
    /var/www/ on line 1238
    ... when I trying to use relations without set primary_key in nested set model.

    2)  Warning - Invalid argument supplied for foreach() in /var/www/ on line 260
    ... when I trying to get root of the tree with set primary_key in this way:

    $root = \Model\Page::forge()->set_tree_id(0)->root()->get_one();

    It worked without primary_key before I wanted to use relations :(
  • I've updated my fuel:

     - Removing psr/log (1.0.2)
    - Installing psr/log (1.1.0)
    Downloading: 100%

    - Installing fuel/core (
    Downloading: 100%

    - Installing fuel/auth (1.8.1)
    Downloading: 100%

    - Installing fuel/email (1.8.1)
    Downloading: 100%

    - Installing fuel/oil (
    Downloading: 100%

    - Installing fuel/orm (
    Downloading: 100%

    - Installing fuel/parser (1.8.1)
    Downloading: 100%

    - Installing fuel/docs (1.8.1)
    Downloading: 100%

    ... but problem did not disappeared. Only errors changed:
    Warning - Invalid argument supplied for foreach() in /var/www/ on line 941 - in both cases: with and without set primary_key

  • You don't have to define a primary key in your model. If you don't, the ORM assumes your primary key is a column called "id".

    If your table doesn't have that, you'll get an error.

    All those code snippets on that page came from a test project used to develop and test the nested page Model, I can't really imagine anything this seriously wrong with it?
  • Oh, it's my stupid bug! This topic can be deleted... It is not useful for any users.

    I set  _primary_key as string value instead of array...

    Oh, shame on me :(

    Sorry. Thank you for your attention.
  • ;-)

    These things happen...

Howdy, Stranger!

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

In this Discussion