I have a channel entry with the "images" field.

The field type is Grid.

What I'm trying to do is add a few pictures in the field through PHP.

I'm using this query to fetch the entry:

$entry = ee( "Model" )->get( "ChannelEntry" )
->filter( "channel_id", 6 )
->filter( "entry_id", 394 )
->filter( "status", "IN", array( "open" ) )->first()

The issue is, that I can access simple fields but the grid is always empty.

I'm not sure how can I access the images in the field or add new images in the field.

Is there any better documentation on model relationships? or a way to achieve this functionality?

Any kind of help will be much appreciated.

1 Answer 1


Few notes / comments on this one.

Firstly, this is an area we need to get better docs around as a whole..

The following thread has a working example in it that may be of use for you.


When saving images specifically, I would just confirm their saved correctly in the DB (ex. try saving the same image in the CP and then programmatically to make sure whats saved in the DB correctly.)

  • Thanks a bunch. I was querying it in a different way so never found any relevant forum post. I'll look into it further. So far I think its gonna be really helpful.
    – Afifa
    Commented Jun 27, 2022 at 15:49
  • Hi Tom, your comment was pretty helpful but rather than creatng new grid fields I wanted to update the exisiting ones. I failed to do with it with "Channel Entry Model". I ended up asking for help from the EE support and that's when they told me, "The main issue is, grid (and relationships) don't fully implement the new models. It's for a variety of reasons, but they just don't." So, I used, "ee()->load->model('grid_model');", "ee()->grid_model->get_entry_rows(...)" and "ee()->grid_model->save_field_data(...)" methods from grid_lib and I was able to implement my desired functionality.
    – Afifa
    Commented Aug 31, 2022 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.