silverstripe / silverstripe-campaign-admin

Campaign and publishing admin interface for Silverstripe
BSD 3-Clause "New" or "Revised" License
2 stars 16 forks source link

ENH Added cascade_add_to_campaign property #233

Closed tiller1010 closed 2 years ago

tiller1010 commented 2 years ago

Summary

Added $cascade_addtocampaign property. This explicitly adds related objects to a ChangeSet when "Add to campaign" is clicked. This allows us to bulk publish child objects without defining them in $owns (sometimes we want to publish data on the parent object, without publishing all child objects too).

class Category extends DataObject {

  private static $db = [
    "Description" => "HTMLText", // We may want to change and publish just this Content, without effecting Products
  ];

  private static $many_many = [
    'Products' => Product::class,
  ];

  // Allows us to bulk publish Products in a Category
  private static $cascade_addtocampaign = [
    "Products",
  ];

}

Testing

Notes

GuySartorelli commented 2 years ago

Thanks for making those changes. Did you rebase when you retargetted the PR? (Sorry, I should have included that in my comment) - the travis tests seem to be using an old configuration which is causing them to fail, instead of picking up the correct configuration from the 1 branch. If you didn't rebase, can you please do that?

If you could also squash your commits down to being a single commit that would be helpful, though I can squash on merge if you have issues doing that (I know squashing can get tricky sometimes).

tiller1010 commented 2 years ago

@GuySartorelli Let me know how this looks!

GuySartorelli commented 2 years ago

Looks good, thanks for the contribution.