cakephp

Conditions in associated models using Model->find() (CakePHP)

Hi, I am having some issues with CakePHP's find() method and conditions in 'deeper' model associations. There are some of these around but I could not find an answer to this so far. My model associations are User hasMany Post hasMany Comment hasMany Vote and Vote belongsTo Comment belongsTo Post belongsTo User respectively. The belongsT...

Why does CakePHP use different plural/singular naming conventions?

Can somebody perhaps explain here why on earth CakePHP has a convention of using plural names for db tables and controllers and singular for models? Why not always use singular terms, or always plural? For me it seems confusing to always have to think "now do I use plural or singular here?" (Or is there an easy way to remember??) And th...

CakePHP Bulider

I have found GUI cakePHP builder in http://www.widgetpress.com/, but it used for Mac. there is GUI CakePHP Builder for windows ? ...

CakePHP same 'view' for multiple functions

I have a Cakephp project the controller has several different methods. function Index() function IndexAuthor() And I want to use the same 'view' (or template, Index.ctp) for both of the methods of the control. ...

Advice needed from PHP/Cake PHP expert

I'm very new to programming (besides SQL and databases), but I ultimately want to master Cake PHP for web development. Now, given how new I am, I'm rather lost as to how I get started. Down the road, I want to use MVC framework so that I help myself be disciplined in the way I build. However, I know basic knowledge of PHP and OOP PH...

CakePHP: Return the SQL for Model::find() rather than running it

Is there a way to get the SQL which would be run for a particular find() query, rather than actually running it? For example: echo $this->Users->find_sql('all'); // "SELECT User.id, User.username FROM users User WHERE 1=1" My own situation would be a little more complicated than this, but I hope it illustrates the desired output. ...

How do I handle json data sent as an HTTP Post to a cakephp app?

If I'm being sent an HTTP Post where the body of the http request is just a UTF8 encoded string, how do I access that data in my cakephp controller? It appears that $this->params only contains the following: { "pass":[], "named":[], "controller":"users", "action":"checkin", "plugin":null, "url":{ "ext":"j...

Cakephp Save with a table where the primary key is not 'id'

I have an existing web application that I am converting to use CakePHP. The problem is that the primary keys for most of the tables are in this format "${table_name}_id" (story_id) instead of the CakePHP way of 'id' When ever I try to update some of the fields for a row in the story table, the Save() function will return false. Is there...

multiple database relationship on field other than primary key in CakePHP

I have a project that necessarily spans several databases. One database has tables: CREATE TABLE device { device_uid integer unsigned not null primary key auto_increment, os varchar(50), name varchar(50) } CREATE TABLE platform { platform_id integer unsigned not null primary key auto_increment, name varchar(50) } The oth...

HABTM data not saving (cakephp).

Hello, I have two models related HABTM (documents and people). class Person extends AppModel { var $name = 'Person'; var $hasAndBelongsToMany = array( 'Document' => array( 'className' => 'Document', 'joinTable' => 'documents_people', 'foreignKey' => 'person_id', 'associati...

Advantages of CakePHP over other frameworks.

What makes cakephp to stand ahead of other frameworks. Is this really topping the chart in terms of PHP programming? ...

MVC Pattern in cakephp

Could someone explain me about MVC pattern? How does it help cakephp framework? ...

Cakephp Session lost in Flash player

Just want to know if anyone have the same problem. The website need to login to perform certain task. We use stock Auth component to do the job. Everything is fine until it hits an interface which build in Flash. Talking to Amf seems fine. But when the Flash player try to talk to other controller - got redirect because the session in n...

There is a way to use a controller action directly as an element in CakePHP?

I want to use the view for one controller action inside another view with CakePHP, and passing some variables. Anybody has been work on this situation or something similar? ...

CakePHP Time Helper Problem

I think I might be making a mistake here. I am getting the following error when trying to use a simple function in the time helper in my controller. I don't get an error when using the same function call in the view. Below is the error from the controller. Followed by the controller code that is failing. Followed by the view code that ...

CakePHP and admin routing with a 'catch all' action.

I'm trying to build a mini cms, whereby all urls go to the index action of a 'products' controller. The products_controller checks the url and treats it as a parameter, so '/widgets' would hit the index($url) function and pass 'widgets' to be the $url param. I then do a lookup like this checking a field called url: $product= $this->Pr...

CakePHP using multiple databases for models

Is it possible for certain models to be in one database and other models in another (using the same connection)? I have a number of read-only tables that I want shared between multiple installations of my system. Other tables need to be per-installation. For the sake of example, let's say users is the shared table, and posts is per-inst...

Managing big applications with CakePHP

Hey guys! I have an application here that is growing bigger and bigger. The address is this: www.aquitanda.com [brazilian portuguese]. Basically, it's a website where you can buy and sell stuff on your own, which means people can create their own webstores. I have, for this project, 4 big "interfaces". One of them is the commom interf...

Adding a prefix to every URL in CakePHP

What's the cleanest way to add a prefix to every URL in CakePHP, like a language parameter? http://example.com/en/controller/action http://example.com/ru/admin/controller/action It needs to work with "real" prefixes like admin, and ideally the bare URL /controller/action could be redirected to /DEFAULT-LANGUAGE/controller/action. It'...

CakePHP: reusing models, controllers, configuration but not views and routes

Hi guys, Our website is going to work as follows: There's a central site www.example.org where everybody can register, change information, manage their 'business card'. Also, everybody will have companyname.example.org. Here users can publish a simple site based on information they change in the main site. This site is being built o...