<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Andy,<br>
I suggest to do the override in the model or business model layer, not dbic::api itself.<br>
This ensures that no other code deletes a row.<br>
<br>
Cheers, Alex<br>
<br>
<div class="moz-cite-prefix">On 2014-08-08 10:16, Andy Holyer wrote:<br>
</div>
<blockquote cite="mid:CAB4f9UzYDSGVwNTBgRqZ0suWMpO4y8E0Spkw1KY7PJ4POwRjkA@mail.gmail.com" type="cite">
<div dir="ltr">I'm working on a Catalyst application which mainly uses Catalyst::Controller::DBIC:API::REST to provide CRUD (Create, Read, Update, Delete) access to a MySQL database.
<div><br>
</div>
<div>A feature the customer requires is that database records are non-destructive, in order to provide an additional level of security (the application is financial, so it's important that users cannot remove records from the actual database). The number of
 records which will be in the final system is relatively low, in the thousands, so the presence of defunct records will not slow down database operations).</div>
<div><br>
</div>
<div>To implement this I have added a flag, &quot;defunct&quot; to all database tables, and I now need to overload the delete and update methods as follows:</div>
<div><br>
</div>
<div>delete -&gt; set defunct to true</div>
<div><br>
</div>
<div>update -&gt; delete (see above) existing record, write updated record to the database.</div>
<div><br>
</div>
<div>What I can't work out at the moment is where in the inheritance hierarchy of classes are the methods I should overload. It doesn't look as though Catalyst::DBIC::API is the correct place, since there seem to be a number of similar but related methods to
 perform deletion and updating. The individual record methods as far as I can see are implemented at the bottom level of Moose, but I'm not sufficiently comfortable with Moose internals to work out exactly what to overload. I'm continuing with research on the
 matter, but thsi must be a behaviour which has been done before, and any advice or pointers to online documentation or tutorials would be very handy.</div>
<div><br>
</div>
<div>Thanks in advance for any help, I will summarize results to the list if need be.</div>
<div><br>
</div>
<div>Andy Holyer, Brighton, UK.</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre wrap="">_______________________________________________
List: <a class="moz-txt-link-abbreviated" href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a>
Listinfo: <a class="moz-txt-link-freetext" href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a>
Searchable archive: <a class="moz-txt-link-freetext" href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a>
Dev site: <a class="moz-txt-link-freetext" href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a>
</pre>
</blockquote>
<br>
<br>
<font face="Verdana" color="Purple" size="2"><br>
*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*<br>
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien<br>
Handelsgericht Wien, FN 79340b<br>
*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*<br>
Notice: This e-mail contains information that is confidential and may be privileged.<br>
If you are not the intended recipient, please notify the sender and then<br>
delete this e-mail immediately.<br>
*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*&quot;*<br>
</font>
</body>
</html>