Note that there are some explanatory texts on larger screens.

plurals
  1. POConfused about model/entity meaning and separation of CRUD and business logic
    primarykey
    data
    text
    <p>I am writing an application where most of the legwork is done in the models, the models perform 2 (fairly distinct) groups of tasks:-</p> <ol> <li>CRUD database operations</li> <li>Create <code>Table</code>, <code>Form</code> and <code>ContentBox</code> objects, populated with with data from the database</li> </ol> <p>Some of the models as a result are quite big, so I have setup the <a href="https://github.com/illuminate/database" rel="nofollow">Illuminate Database component</a> from the <a href="http://laravel.com" rel="nofollow">Laravel framework</a> and I am thinking of using the Eloquent ORM to create models that do the CRUD and then have separate models which generate the Tables and Forms, calling methods in the Eloquent models to get data.</p> <p>What would be the correct terms for these 2 different 'models' in domain driven design? Do I call the models that do the CRUD <strong>entities</strong> and the other models <strong>models</strong>?</p> <p>I've read a few of the related posts and I understand a model is a model of something in the real world. So for example I've got a model called <code>Invoices</code> which has methods for returning a <code>Form</code> object, for creating a new invoice, and a <code>Table</code> object, for listing all the invoices. But it also has a method for returning a PDF of a single invoice. So this isn't really a model of a single invoice - it has the ability to return data for multiple invoices... is this still a model?</p> <p>Apologies there are actually 2 questions here, I'm just wondering what the correct terms are, or looking for suggestions to somewhere I can read about this sort of thing, so that I can do something that is considered best practice and will make sense to other programmers.</p> <p>Thanks in advance.</p> <p><strong>Update</strong> So after reading <a href="http://blogsh.de/2011/09/08/models-vs-entities/" rel="nofollow">this</a> it seems to me that what Laravel calls a <em>model</em> (before adding business logic to it) is in fact an <em>entity</em>. So what I'm planning to do is have a folder called <code>Entities</code> with my ORM 'models' in and another folder called <code>Models</code> with the business logic 'models' in - is this common practice?</p>
    singulars
    1. This table or related slice is empty.
    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. 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