FAQ Database Discussion Community


Trouble linking models together in CakePHP2

php,cakephp,cakephp-2.6
I'm using CakePHP 2.6.7. Here is my database (simplified) : ***Users*** id username ***Cars*** id CarMake CarModel NumberPlate user_id ***Addresses*** id address postalcode city country ***Addresses_Users*** user_id address_id This is what I want : One user can have multiple cars and one car is owned by only one user. One...

how to fetch users with countries, cities, states by using containable behavior in cakephp 2.x

php,mysql,associations,relation,cakephp-2.6
I have these models : Country,State,City,User with relations : Country hasMany State, State hasMany City, City hasMany User, State belongsTo Country, City belongsTo State, User belongsTo City, Now I want to fetch all the users with not only their cities but also countries and states. How can I do this?...

Modify $this->request->data in model CakePHP?

php,cakephp,cakephp-2.6
How can I modify $this->request->data from model in CakePHP. I tried it with code in model User : public function beforeValidate($options = array()) { unset($this->request->data['User']['birthday']); } But it return errors : Notice (8): Indirect modification of overloaded property User::$request has no effect Warning (2): Attempt to modify property of non-object...

CakePHP 2.6.0 is not loading CSS and JS files

css,.htaccess,cakephp,mod-rewrite,cakephp-2.6
I just uploaded my website to the server but is not loading the css and js files, only I can see the site just like text and after put the .htaccess files in their places I got this message in the site: Internal Server Error The server encountered an internal...

Cakephp 2.6 how do I return to the main application after entering a plugin

cakephp,plugins,url-routing,cakephp-2.6
I am using Luis Dias' Report Manager Plugin to generate some quick reports for an application I am developing. From my application dashboard I enter the plugin using the following: <td style="text-align:center"> <button style="height:75px; width:175px; background-color:BurlyWood; font-size:20px; font-family:Verdana" onclick="window.location.href='<?php echo Router::url(array('controller'=>'report_manager' ,'action'=>'reports'))?>'">Report Management</button> I'd really like to open the Report...

CakePhp 2.6.3 Auth component not working. Accepting any userID/password combination

cakephp,cakephp-2.6
I have been trying to get cakephp 2.6.3 auth component for my site to work for a week now. The problem am facing is that when ever I enter any bogus user ID/password combination, the login function returns true. i have read all is there to read and watched tutorials...

Is there a way to get the config for a dynamically loaded behavior in CakePHP 2.x?

cakephp-2.6
Example: $Model->Behaviors->load('Some.Behaviour', $options); // Now how do I get $options back from the model? Is there a way to get $options? $Model->actsAs remains empty....

Cakephp 2 Routing / SEO friendly urls

routing,cakephp-2.6
totally new to cakephp and really struggling to understand the docs. Idea I'm working on is for a rental property search. I have controller rentalsController In here I have index which I fetch all I also have a sidebar which lists regions Now, what I want to happen is for...

Integrate Wordpress CMS in CakePHP

php,wordpress,cakephp,cakephp-2.6
I'm trying to integrate Wordpress in CakePHP 2.6.1 to use it as a CMS for my end users. I'm including the required file to access wordpress functions: wp-blog-header.php. As CakePHP only allows to include files located inside CakePHP I placed the wordpress intallation inside app/Vendor/wordpress and now I'm trying to...