I'm using a customly created MySQL input sanitization library in one of my controllers, which makes a mess, using it in the model would be much easier, but I don't wan't to defy any best-practice principles out there either. So is it a good idea?
+1
A:
I ran into this myself. You know what? If it makes your application work, screw conventions. If you need to call a chunk of code that you've already written (and you know it will work), then there's no good reason to follow "best-practices" and do something that will effectively make your app slower/less efficient/etc.
The whole point of best practices is to write code in the best way. If the best way that something seems like it should be done is by calling a library from a model, go for it. Best practices are not a universal law.
mattbasta
2010-03-20 18:14:11
for me thats one of CI's main advantages. Its not too restrictive and lets you adapt it to your needs.
Iraklis
2010-03-22 16:12:25