pkp/omp — comment on commit d9a2be2ae589ec90dc942676560d43eda561cb40
File: controllers/modals/editorDecision/form/EditorDecisionForm.inc.php line 138
By beghelli:

Hi Alec,

Yes, it is a pattern that I am using very often until now (in 4 methods, at
least).

I tried to create a method using the ADODB's replace function, but I
couldn't because our DAO class currently don't use the $has_autoinc
parameter, so it is set to false by default. But the notification table has
a autoinc primary key, the notification id. Can I adapt the DAO class to
pass this parameter to the ADODB's replace function?

Regards,

Bruno.

2011/10/6 Alec Smecher <
reply@reply.github.com>

> There's an alternative to this "check and create only if it doesn't already
> exist" pattern, if you find you're using it very often -- it might be worth
> implementing a NotificationManager / NotificationDAO method that uses
> ADODB's "replace" function.
>
> --
> Reply to this email directly or view it on GitHub:
>
> https://github.com/pkp/omp/commit/d9a2be2ae589ec90dc942676560d43eda561cb40#commitcomment-635222
>