cakephp-1.3

Incrementing Cakephp database field by a value

本小妞迷上赌 提交于 2019-11-26 23:15:58
问题 I have this field whose value i have to increment the field value by a specific value. I am using this $data['quantity'] = 'Order.quantity+1'; which doesnt works for me quantity is a integer coloumn here. Also will it work when nothing is in database?. Regards Himanshu Sharma 回答1: you can use updateAll() for this a little googling reveals this pretty quick: http://cakephp.1045679.n5.nabble.com/Auto-Increment-A-Field-td3491697.html 回答2: I used updateAll in my code to increment views in an

CakePHP Cookie/Session problems

若如初见. 提交于 2019-11-26 22:53:42
问题 I am having issues with my CakePHP application. This seems to be happenining only in IE, and only on certain computers. It is consistent on the computers where it is happening though. Issue one: User is logged in and on the page https://example.com/users/view and clicks sign out. User is redirected to http://example.com and appears to be logged out until the user visits another https page and they are still logged in. They can click log out as many times as they want but they are always

Set Response Status Code [duplicate]

感情迁移 提交于 2019-11-26 19:57:37
This question already has an answer here: PHP: How to send HTTP response code? 8 answers I have an API call for which I need to be able to run some checks and potentially return various status codes. I don't need custom views or anything, I just need to return the proper code. If the user hasn't passed proper credentials, I need to return a 401 status. If they haven't sent a supported request format, I need to return a 400 status. Because it's an API, all I really want to do is set the response status and exit with a simple, stupid message about why the request failed (probably using a exit ).

CakePHP: best way to call an action of another controller with array as parameter?

六眼飞鱼酱① 提交于 2019-11-26 18:06:09
问题 In a controller, what is the most appropriate way to call the action of another controller and also pass an array as parameter? I know that you can use requestAction to call actions within other controllers. But is it possible to pass arrays as parameters using request action? And no, I do not want to put the action in the App Controller. So that is not a solution for me. The only other way I know is to load the other controller as explained in: http://book.cakephp.org/1.3/en/The-Manual

CakePHP switch database (using same datasource) on the fly?

孤人 提交于 2019-11-26 16:29:16
问题 I have tried to build a small function that would be use in controller to switch database on the fly, i must use only one datasource. On my database.php : function __construct() { $server = Configure::read('Server'); if(!empty($server['database'])) $this->local['database'] = $server['database']; $this->default = $this->{$server['datasource']}; } Is used to switch database depending on server config. It is working great. I tried to build up this : /** * Connects to specified database * *

Cakephp Auth with multiple “Users” tables

喜欢而已 提交于 2019-11-26 15:28:59
问题 I would like to know how to deal with only ONE authentification process and "users" in multiple tables. I have 4 Users table: users, admins, artists, teamadmins which all have specific fields, but I would like all of these users to be able to connect via only one form on the homepage, and being redirected after that to their specific dashboards. I think the redirections shouldn't be a problem, and some routes added should work, but I really don't know where to look/start to ake this all

Saving HABTM with extra fields?

我的梦境 提交于 2019-11-26 14:25:23
问题 I am trying to save an order, and the products in the order. The order is being saved, but the products are not. I have an orders table and a products table and a orders_products table. In the Order model I set $hasAndBelongsToMany = 'Product'; on the orders_products table I have a couple extra fields: order_id , product_id plus price , quantity to capture the sale price and quantity sold. I am saving the data via: $this->Order->saveAll($data); Here is what $data is: Array ( [Order] => Array

How to eliminate php5 Strict standards errors?

孤街醉人 提交于 2019-11-26 12:42:47
问题 After upgrading my PHP to 5.4.3 (WAMP server 2.2), my web app made in CakePHP 1.3, is showing the following errors in my index: Strict standards: Redefining already defined constructor for class Object in C:...\\cake\\cake\\libs\\object.php on line 63 Strict standards: Non-static method Configure::getInstance() should not be called statically in C:...\\cake\\cake\\bootstrap.php on line 49 I\'ve found that some people solve this problem by setting the error_reporting in php.ini to E_ALL & ~E

Set Response Status Code [duplicate]

陌路散爱 提交于 2019-11-26 07:28:58
问题 This question already has an answer here: PHP: How to send HTTP response code? 8 answers I have an API call for which I need to be able to run some checks and potentially return various status codes. I don\'t need custom views or anything, I just need to return the proper code. If the user hasn\'t passed proper credentials, I need to return a 401 status. If they haven\'t sent a supported request format, I need to return a 400 status. Because it\'s an API, all I really want to do is set the