Cakephp make some thing easier for developers I think this is a good frame work.
They develop a “vendor” technique to connect external library.
We have no way to access Database from my library functions. According to cake convention I need “$this” variable to execute my queries. Really I am upset with about their “VENDOR” method where I can not use this variable directly because my class in not extended by controller class.
Then I had to do a stupid work. I call the vendor() then send the $this variable in the construct of my library class and copy it in a Global variable in my class. Then I use this global variable to do all my works. I believe this is a not a good way but I have noting to do. I think cakeGroup will update it to make our life easy.
UPDATE:
I am sorry, this post become so attacking. Actually I like cakePHP and I develop more then 10 projects with it. It actually came from my love. Finally I got the point.
And this is not true that we can not use cakePHP’s database connection in new class. We can do it by passing “$this” in my new class. But need a well define way.
We can register our class in the framework so that cakePHP can recognize new classes.
I hope everybody taking this post easily.
Thank you All
Mentors Award Q3 2008
Top Website Coder
9 responses so far ↓
Junal // July 10, 2007 at 6:32 pm |
im totally agree with you mr rubel. here we can not say that CakePHP is a open source framework. if it’s not so then why i have to call the created class in different way thro vendor shit??. is CakePHP scared of anything? then why they are just protecting the package from the developers ? it means ur not quit free in Cake. but i guess they should think about it and let develpers enough freedom to use Cake on their own way….
Geoff // August 8, 2007 at 10:38 am |
The reason vendors is the way it is is because Cake makes no assumptions about 3rd party classes or libraries.
For example: vendors(‘my_library’) will load my_library.php but there my not be a MyLibrary class in the file. In fact there may not even be any classes in there. Therefore Cake cannot automagically create a $this->MyLibrary variable.
When using vendors() you are left to use the library the old fashioned php way. i.e load, instatiate, use.
Cake makes things easy but it cannot support every configuration in every third party library. Sometimes you just have to do it yourself.
Geoff
Vendors in CakePHP « Another Cake Baker // August 8, 2007 at 10:44 am |
[...] Original post. [...]
Rubel // August 9, 2007 at 12:11 pm |
Hi,
Thnx Zakir & Shiakil.
I did not forgot you guyes. I am going to add some more lines in my post.
Ya.. We should enjoy a party after the Siemens project.!!!
Thak you all
nate // November 25, 2007 at 4:38 am |
This is the second-stupidest blog post I have ever had the misfortune of wasting my time to read.
Normally I would take the time to explain *why* it’s so stupid, but (a) given the depths of stupidity here, you don’t really warrant a response from me and (b) a level-headed, non-insulting response has already been written.
Exhibit A: http://lemoncake.wordpress.com/2007/08/08/vendors-in-cakephp/
Oh, I almost forgot. Exhibit B: http://www.chicagomanualofstyle.org/
Josh // March 22, 2008 at 1:21 pm |
Global Variables are a bad idea to start with, any security conscious programmer should be aware of that.
nate has explained everything in his post.
“The reason vendors() is the way it is is because Cake makes no assumptions about 3rd party classes or libraries.”
I’m not really sure what you are trying to do either, you want some of cakes classes but you want to out source it to another vendor. Why not re-write it as a Component or a Helper?
rubel // March 22, 2008 at 2:01 pm |
@Josh
You are right. Actually I wrote this post when I started cakePHP.
I like all other features except the vendors. I think CakePHP should allow to use it’s resources in the new code I added by Vendor. At least database. It will make our life easy.
@ nate
Thank you mate. As you describe the fact in your post.
Thank you.
John // January 3, 2009 at 4:43 pm |
I\’m love this great website. Many thanks guy
Alexwebmaster // March 3, 2009 at 11:51 am |
Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru