-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce "civi.dao.preUpdate" and "civi.dao.preInsert" events #16714
Conversation
(Standard links)
|
This looks good - would be nice to get some feedback from @totten if possible? |
@christianwach could you also update documentation? |
@jaapjansma How do I do that? |
@jaapjansma Oh jeez, yet another complicated CiviCRM workflow to get my head round! FWIW, there's practically no documentation to be found on any individual Symfony hooks as yet (I assume this is because they are considered "internal") so I'd appreciate feedback on whether it's a good idea to start with these ones. |
@totten and @eileenmcnaughton what do you think? Is there any reason why the symfony hooks don't have any documentation? |
There is some general symfony docs here: https://docs.civicrm.org/dev/en/latest/hooks/usage/symfony/ In this case I would suggest adding a note about these new ones to the existing hook_civicrm_pre/post pages. |
Given that all the hook signatures are always identical (i.e. two params |
It's nice to know what to put in |
If stuff isn't CiviCRM specific I'd rather we link to symfony's docs where appropriate rather the re-writing stuff or maintaining our own documentation for symfony code - their docs are pretty good. |
@mattwire Isn't that already covered by this section of the docs? |
/** | ||
* @var mixed | ||
*/ | ||
public $result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there really no consistent data type for $result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eileenmcnaughton Thanks for highlighting the docblocks as being in need of some TLC. I think that your observations apply more generally to this class - and most likely to other classes too. I'd be happy to tackle those in a separate PR.
/** | ||
* @param $object | ||
* @param $result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add data types to the code blocks (I know it's not there for '$object' :-(
public $object; | ||
|
||
/** | ||
* @param $object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto this should have a type
@colemanw thoughts on this? Seems consistent with the delete one we recently discovered.... |
I agree this looks sensible - making the set of events more consistent (with the examples of |
@christianwach I'm going to merge this as it seems to have wide approval. The docblocks and documentation needs some work and you've said you'll follow up on that :-) |
Overview
This PR is for this issue on GitLab and mirrors the pattern of
hook_civicrm_pre
+hook_civicrm_post
andhook_civicrm_preProcess
+hook_civicrm_postProcess
and the existing pattern ofcivi.dao.preDelete
+civi.dao.postDelete
to complete the set with:civi.dao.preInsert
+civi.dao.postInsert
civi.dao.preUpdate
+civi.dao.postUpdate
Before
There isn't a hook available to inspect (for example) the data of an Option Value prior to it being created or updated programatically.
After
It is possible to inspect the data of an Option Value prior to it being created or updated programatically.
Technical Details
With this PR, the following comparison between Option Value data before and after it is updated becomes possible: