Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you separate out your storage in data a data access layer you get the separation you want and the functionality in the model:</p> <pre><code>DAL (doing queries etc) | Model (doing business) | Controller | View </code></pre> <p>So in the view you have an action: Mark as Paid. So you controller gets the request (POST) /invoice/1/markaspaid (or any other url structure you use). Then the controller calls the model:</p> <pre><code>$Invoice=new Invoice(); $Invoice-&gt;markAsPaid(1); </code></pre> <p>Then your model calls the DAL to actually store this change. There is no real need to separate this from the models. If it is very complex or very transactional you might think about a separate service for a complex task. That way your model gets thinner and the complex part gets separated.</p> <blockquote> <p>What is the best way to interact with the data, keeping the flexibility of the model and keeping the functionality the model doesn't care about at the moment (like sending a mail with an activation link when changing the email address)?</p> </blockquote> <p>I don't understand this totally. As far as I see it you should separate the send e-mail process anyway from your normal code run. So put it in a queue and find it out there. It isn't part of your normal code path. You might initiate it from your model but that's about it.</p> <p>See this question which has relevant info on that topic: <a href="https://stackoverflow.com/questions/11266385/cakephp-cron-job-to-call-a-controllers-action/11266504#11266504">Cakephp cron job to call a controller&#39;s action</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload