title: How to do set sessionflash if SQLSTATE[23000] foreign key cakephp
body: <p>I have two tables:</p>
  
  <p><img src="https://i.stack.imgur.com/yPh48.png" alt="Picture"></p>
  
  <p>When I try to delete <code>product_categories</code> it shows the following error:</p>
  
  <pre><code>SQLSTATE[23000] Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails 
  </code></pre>
  
  <p>I want set session flash if it error?</p>