Jump to content

Images get lost, when I remove a repeater


Recommended Posts


it ist frustrating: if I remove an item of a repeater with help of the API, all images in my page get lost. I have absolutly no idea, why.

    $gruppe = (int) $input->get->gruppe;
    $mitarbeiter = (int) $input->get->mitarbeiter;
    $m = $pages->get($mitarbeiter);
    $delGruppe = $m->gruppenzuordnung->get("gruppe=".$gruppe);
    $m->gruppenzuordnung->remove($delGruppe); // If I remove this line, no images are lost

The lost image is in $m->image. It has nothing to do with the repeater $m->gruppenzuordnung. They remain on the server as file, but not in the database.

Has any one an idea?


Link to comment
Share on other sites

9 hours ago, sekru said:

if I remove an item of a repeater

Which one is the repeater? gruppe? You are trying  to remove the repeater form its own item, as far as I can see. $m is a Page object, not a (Repeater)PageArray if I'm correct:


So incidentally it is probably the image this line removes because of a matching key of the image:


You need to work on the RepeaterPageArray:


like this: $delGruppe->remove($m); // or $gruppe->remove($m); // depending on what you want to achieve

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...