View more context

 

dorsetdigital

Are you doing these checks in the CMS? Are you aware of the isChanged() methods?

rista

and yes I'm aware of isChanged and getChangedFields but I need some additional information

rista

and also I need to update that instance in order to check if it's changed

Jay
  1. if (isset($searchParams['DraftOnly'])) {
  2. // get draft only records
  3. $stage = Versioned::get_by_stage(Items::class, Versioned::DRAFT)->column('ID');
  4. $live = Versioned::get_by_stage(Items::class, Versioned::LIVE)->column('ID');
  5.  
  6. $ids = array_diff($stage, $live);
  7. if (empty($ids)) {
  8. $query->filter('ID', 0);
  9. } else {
  10. $query->filter('ID', $ids);
  11. }
  12. }

Guys I am having a final issue with my search problem. These DataObject (Items) has over 200,000 results and I am trying to fetch just the draft versions but this is proving to timeout. Is there a better solution to getting just the Draft items?

Conan
Conan in #ss4 2019-11-29 12:19:24 (edited) (deleted)

You could also first just query the $liveIds and then exclude the IDs.

  1. $stage = Versioned::get_by_stage(Items::class, Versioned::DRAFT)->exlude('ID', $liveIds); // <- check that $liveIds is not empty, SS4 does not filter on empty sets.
Chris

my desperate reach for input: can anyone help me with this question? https://stackoverflow.com/questions/59098141/silverstripe-formschema-with-submissions-and-validation

Show 1 attachment(s)
Stack Overflow  
Silverstripe - FormSchema with submissions and validation

I'm trying to make use of the new FormSchema class in Silverstripe 4 but I'm having a tough time with the workflow for submitting the form. I've been able to return the schema and state, but when

Hide attachment content