Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created September 9, 2015 16:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kinglozzer/d4c3aa80f7015a89d183 to your computer and use it in GitHub Desktop.
Save kinglozzer/d4c3aa80f7015a89d183 to your computer and use it in GitHub Desktop.
Injector:
ManyManyList:
class: ManyManyListWithHook
<?php
class ManyManyListWithHook extends ManyManyList {
/**
* @param mixed $item
* @param array|null $extraFields
*/
public function add($item, $extraFields = null) {
parent::add($item, $extraFields);
if($item instanceof DataObject) {
$item->extend('onAfterManyManyAdd');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment