close
  PHPDiscussion

OOP and Cake



dino-rizzoniMar 14, 2007 10:12am
I've been away from PHP for a while and am just coming back to it - I thought I'd use this return as a chance to learn about OOP, frameworks, MVC and other PHP5 goodies - and I'm finding it quite a steep learning curve.. any advice from out there - have you switched from procedural to OOP - is it really worth it? any opinions on frameworks? I tried Zend, PHPontrax, Symfony and Cake, and Cake is definitely the easiest to get cracking with, though Symfony looks more complete. I still don't QUITE understand all the neverending little arrows bob->jim->mary, but I think I'm getting there...


Sponsor
StrangeJMar 14, 2007 12:57pm
I just switched to OOP php, and its not too bad, certainly worth it if you have a lot of different repeated 'modules' for your website. Just search for 'PHP class tutorials' or something similar.

As for the arrows, they simply mean that 'bar' is either a function or variable of the class 'foo' in foo->bar.


Sponsor
ThlayliMar 14, 2007 5:21pm
And => ?


Sponsor
jordayMar 14, 2007 9:16pm
$bar->foo(); // foo is a function of the instantiated class stored in $bar
$bar->foo; // as above but its a variable, not a function

bar::foo(); // foo is a function of a static class (doesn't store data)
bar::foo; // a variable of the static class

Static classes cannot be changed. e.g. bar::foo = "blah"; won't work
while $bar->foo = "blah"; will.

Clear as mud? =)


dino-rizzoniMar 19, 2007 3:29am
Aha! Actually that's quite helpful. What I've been doing at the moment, which may sound stoopid, but is working, is writing rough pages in procedural so I cna test interactivity and see what I need, then going back and wading through the making of the classes. I've also discovered Bake, which is handy, but not perfect as I am working with lots of join tables, and Cake isn't perfect with HABTM relationships...


phpguruNov 25, 2008 2:41pm
With PHP5 now PHP very close to be a real OOP

There are many numbers of frameworks developed for PHP also in last years.

cakePHP is one of them with its ORM structure, it's easy to use and learn, but it has some solid rules, not flexible and usually need a normalized DB structure to work with.

In the other hand Zend Framework is the most flexible one in my oppinion, but it's a little harder to handle with it.

In ORM side, there is a less known uncontinued framework name QCODO, with its ORM structure, none of the existing PHP frameworks close to it.


OOP and Cake


You need to Sign-up for StumbleUpon to post to this forum