0

In case you're not sick of hearing about my chat application... The main part of the application, the piece that does all of the back end work is in the "models" directory. The class is called AEDC_Model_Chat (AEDC is the namespace) but this particular class isn't actually an "object". It is never instantiated, and it only exposes static methods.

So, I am thinking this isn't actually a model, and doesn't really belong in "models". Any thoughts?

1

1 Answer 1

1

IMO, I think it's fine for static based classes to reside in the /models dir. In working with Propel and Doctrine, they have Peer and Table classes (respectively), that are never meant to be instantiated, instead they are meant to implement business logic upon objects to which they are associated. Example dir listings:

// Propel
/lib/model/mydb
    Vehicle.php // Instantiable
    VehiclePeer.php // Works with vehicle object(s)

// Doctrine
/lib/model/mydb
    Vehicle.php // Instantiable
    VehicleTable.php // Works with vehicle object(s)

--Update--

Need to make a correction (doesn't change the answer), with respect to doctrine, the "*Table" classes CAN be instantiated, but they still behave the same as I described above, in that the included methods are meant to work with associated object(s). Your usage of the "static" classes is closer to the way Propel works, and as I mentioned earlier, acceptable to reside in the /model dir.

Sign up to request clarification or add additional context in comments.

1 Comment

That makes sense... I am relatively new to MVC and I do know that I don't want tons of logic in the controllers, so initially it seemed most logical put those things in models. Thanks for your insight.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.