Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC and ORM - which Model logic goes where?
    primarykey
    data
    text
    <p>For clarity consider a fairly standard "User registration" functionality:</p> <p>My ORM (Propel) allows you to alter the class <em>ormUser</em>, which extends the <em>ormUserBase</em>, in order to introduce custom functionality.</p> <p>Now that I have coupled Propel with an MVC framework I am wondering which logic should go where from a best practice point of view.</p> <p>For my user registration functionality I'd create:</p> <blockquote> <ul> <li><p>RegistrationController - <em>which uses the</em></p></li> <li><p>UserModel - <em>which in turn should call something like</em></p></li> <li>LoginView</li> <li>LogoutView</li> <li>SignupView</li> <li>ProfileView</li> </ul> </blockquote> <p>The <em>user</em> database table is coupled with <em>user-profile</em> and Propel has generated handy methods to work with these tables. But now Propel's standard methods are not sufficient and I need to extend functionality.</p> <p>Where would one do this correctly?</p> <p>Would I only extend <em>ormUser</em> for new query methods and place non-query logic in my <em>UserModel</em>? Or would you simply ignore <em>ormUser</em> and use <em>UserModel</em> for everything custom, calling other <em>ormTableNameClass</em>-s there as needed for my logic?</p> <p>I understand keeping new methods in Propel has the benefit of reusability in other Models and Controllers, but I'm not sure from a "do it correctly" point of view since it seems I need business logic to determine the outcome of certain queries.</p> <p><em>UPDATE:</em> <a href="https://stackoverflow.com/questions/4869336/using-orm-classes-directly-from-the-controller-in-mvc-bad-practice/4884215#4884215">Using ORM classes directly from the controller in MVC, bad practice?</a> shows how one usually works with Propel, which in my mind overlaps the framework's model...</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.
 

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