Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
$_has_many relations
  • Hello!

    I have two tables, first has field advert_id,
    second - image_id, advert_id, original_path

    I set models and relations correctly (I gues), because in view this expression $advert->images[5]->original_path
    gives what I want (in this example "5" is image_id, I guess you know that :)).

    But I have a question, how can I dynamicaly recieve a list of image_id's to set [$image_id] ($advert->images[$image_id]->original_path).

    For more understanding I mean the next. For the first advert images_id are 1,2,3,4,5 . How can I get this list?

    May be its too late and I'm tired... but I dont know how can I get it))) Or my knowledges are still small in FuelPHP :)

    Thank you.
  • You can use array_keys() functions, i think keys of array entities is the id of the entity
  • Thank you very much for help!

Howdy, Stranger!

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

In this Discussion