At my new job, I'm writing a quite full-featured web application.
I've choosen to use CakePHP.
Why? Well, it may be 2 years since I last used it, but I've followed the project and it's planet, and it seems to have matured and gained even more monumentum.
I want to use something that is widely used so there is plenty of stuff available for it, it's RAD, it's flexible and powerful.
I noticed things such as CLI support and documentation have improved tremendously too.
However, I find that still, the recommended (or at least "most commonly used") practices are not as efficient as they could be, and that emphasis is placed on the wrong aspects.
See, even though the bake tool has come a long way since I last used it, it's still used to "generate some standard models/controllers/views" and the developer can take it from there [further editing the resulting files himself].
Finetuning generated code by editing the templates (in fact, only views have templates; the php code of models and controllers is hardcoded in the scripts that generate them), is still an obscure practice...
Also, there are very few commandline switches (Right now you can choose your app dir, whether you want to bake a model,controller or view, and it's name.)
All other things (validation rules, associatons, index/view/edit/add actions/views, which components, overwrite yes/no etc) are all handled interactively.
There are also some smaller enoyances such as when you specify one option like the name of the model, it assumes you don't want interactivity and produces a model containing nothing more then the class definition and the membervariable $name, which is usually worthless.
One thing that is pretty neat though, If you update $this->recursive in a model, the baked views will contain stuff for the associated things. But so much more could be done...
::Read from here
Ideallistically speaking, the bake tool (and it libraries) should imho become much more advanced:
We could then do a paradigm shift to actually treat your models, views and controllers as uncritical "output" code which can be deterministically regenerated (and hence doesn't need to be versionned), while the templates and the scripts to call bake become your "source", and your key asset to building the application you're working on.
If I had the time (or would use cake for personal projects) I would happily work on such refactorings in a clean way.
For now though, I've hacked/workarounded/patched the cake code in such a way that it behaves the way I want, while spending as little time on it as possible.
For those interested, the patched code is online at http://github.com/Dieterbe/cake/tree/master
The first rev is the original cakephp code, so you can look at the diffs if you want.
Changes until now ( http://github.com/Dieterbe/cake/commit/9ceb6234164ebc750c8b697a825834ca3... ):
Here is the bash code which I currently use to bake all my models without any interactivity:
[code lang="bash"]
for i in `cake bake model <<< 'q' | awk '/^[[:digit:]]/ {print $2}'` #get a list of all models
do
if [ $i != Aro ] && [ $i != Aco ] && [ $i != ArosAco ]
then
echo ">>> doing $i...."
cake bake model $i
fi
done
[/code]
I may post later again about this stuff if I have something useful to say.
posted on Monday, 19 Jan 2009 22:16 - link - tags: cakephp, foss - path: / - 4 comments
Posted by Bart Verwilst on Mon Jan 19 17:41:27 2009
Yeah, when I wrote my thesis I did a comparision of some frameworks.
Symphony was in the list too. Iirc I didn't choose it because I found it too complicated. Eg all the configuration options, the ORM layer with xml configuration etc. Also, I seem to remember the codebase of the framework itself was much bigger, so less easy to get into :-)
Posted by Dieter_be on Tue Jan 20 06:22:10 2009
console/libs/tasks/model.php Line 248: + exec("awk '/[[:blank:]]$fieldName.*cake validate $modelname/ {print \$NF}' /home/dieter/code/crm/branches/dieter/code-misc/colomanager.sql",$output,$exit);
Would you be so kind as to provide this file? /home/dieter/code/crm/branches/dieter/code-misc/colomanager.sql
Your changes are slightly useless without it.
Posted by David Souther on Thu Apr 22 14:03:45 2010
This is the SQL file you were talking about? It would be nice to get some more documentation, and use an actual config file. I will probably add that now.
Posted by David Souther on Thu Apr 22 14:08:10 2010
Have you ever tried Symfony? I've worked with it before, but never was interested enough in CakePHP to try it out.. Maybe if you have used both already, you might be able to give some pro's and con's on both :)
Bart