Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-72779

Set more than one value on a persistent at the same time

    XMLWordPrintable

Details

    Description

      It would be nice to have some new method in the persistents API that allow us to set more than one value on the persistent at the same time. For example we usually have to do something like this to set several values:

       

      $programuser->set('status', $validateddata->status);
      $programuser->set('startdatelocked', $validateddata->startdatelocked);
      $programuser->set('startdate', $validateddata->startdate);
      $programuser->set('duedatelocked', $validateddata->duedatelocked);
      $programuser->set('duedate', $validateddata->duedate);
      $programuser->set('enddatelocked', $validateddata->enddatelocked);
      $programuser->set('enddate', $validateddata->enddate);
      $programuser->update();

       

      Having some method like this one to pass an array of values would work:

      $programuser->set_many((array) $validateddata)->update();

       

      Attachments

        Activity

          People

            pholden Paul Holden
            davidcarrillo David Carrillo
            David Carrillo David Carrillo
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              19/Apr/22

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 51 minutes
                51m