cakephp

Update CakePhp View each time a record is inserted in the db table

烂漫一生 提交于 2020-01-06 08:04:26
问题 Am making an application that will enable remote viewing of records and reports via a browser. I have used cakePHP to make the application and its working fine,but i have one little problem,since the application does not do any inserts its just reading the data,i want when a user has opened a view and a record has been inserted on the table,it should update all open clients, instead of the user refreshing the page to get the new records. Is there a cakePHP websocket plugin that actually works

How to get $settings data out of CakePHP 2.0 FormAuthenticate object

僤鯓⒐⒋嵵緔 提交于 2020-01-06 07:57:07
问题 I am building a RememberMe Component using the AuthComponent and would like to get the BaseAuthenticate::$settings data (userModel and fields) data out of the XxxxAuthenticate object so I can know what model and fields I should be dealing with, but I can't seem to figure out how to get that data back out. Any suggestions? Basically I need something with the same functionality as Auth::getModel( ) or Auth::$userModel from Cake 1.X. Cake- 2.0.3 回答1: Auth::$userModel still exists in 2.0. However

CakePHP - How do I join a table on a joined table?

拜拜、爱过 提交于 2020-01-06 07:34:11
问题 I am in the FilesController and I'm trying to get a file based on the condition that its order belongs to the current user. FilesController // Check the file exists and that it belongs to the user $this->File->find('first', array( 'conditions' => array( 'File.id' => $id, 'Order.Customer.id' => $this->Auth->user('id') ), 'recursive' => 2 )); Cake SQL Error Unknown column 'Order.Customer.id' in 'where clause' I'm trying to get the SQL to left join orders onto files and then left join customers

Cakephp sending UTF-8 Emails and lineLength

梦想的初衷 提交于 2020-01-06 07:26:14
问题 I'm trying to send an emails with UTF8 characters. Mostly the Email looks how I suspect, but randomly there will be garbage characters. I believe the garbage characters happen when a new line is inserted in the middle of one of the characters. I suspect CakePHP's email component is the culprit since I was reading that it has a feature to insert new lines according to its lineLength property. Is there any way to fix this? I'm using CakePHP 1.3. $this->Email->to = $sendEmail; $this->Email->from

CakePHP - file structure confusion - different controllers, or all in same?

末鹿安然 提交于 2020-01-06 07:13:07
问题 To understand my confusion/question, let me first give a quick overview of the site I'm building: The site has a homepage, and 7 category pages, each with the same/similar layout. On most category homepages (eg "Dining"), you can do a search (ie a search for restaurants), which will take you to a results page. This will have the same/similar layout as the... "Theaters" search result page...etc etc. So - although there are a lot of sections, there are not a lot of page layouts. Question: I'm

CakePHP - file structure confusion - different controllers, or all in same?

[亡魂溺海] 提交于 2020-01-06 07:11:39
问题 To understand my confusion/question, let me first give a quick overview of the site I'm building: The site has a homepage, and 7 category pages, each with the same/similar layout. On most category homepages (eg "Dining"), you can do a search (ie a search for restaurants), which will take you to a results page. This will have the same/similar layout as the... "Theaters" search result page...etc etc. So - although there are a lot of sections, there are not a lot of page layouts. Question: I'm

Issue in hasMany associated model data update/modify

我们两清 提交于 2020-01-06 06:11:40
问题 I have two table, categories hasMany products id name active products belongsTo categories id name category_id active When I am editing the categories, in the same time I am also displaying the Products related to the category so that I can update/modify products related to the category. Issue:- When I add more products for the category that works fine but when I remove some products from the category,the removed product does not get deleted from the database. So I want to know that This

Issue in hasMany associated model data update/modify

北慕城南 提交于 2020-01-06 06:11:12
问题 I have two table, categories hasMany products id name active products belongsTo categories id name category_id active When I am editing the categories, in the same time I am also displaying the Products related to the category so that I can update/modify products related to the category. Issue:- When I add more products for the category that works fine but when I remove some products from the category,the removed product does not get deleted from the database. So I want to know that This

CakePHP error Allowed memory size exhausted

Deadly 提交于 2020-01-06 05:36:06
问题 On one of my PHP applications I get Allowed memory size exhausted error. What did i done wrong to get that error? It's showing on pages where i use more-less usual cakephp methods like 'find', to select record from database table, on index (list) pages. How can i fix that? problem is that i can not set memory size on commercial servers.... Thank you in advance! 回答1: Research the 'Containable' behavior for your models. It's a core behavior, and it sounds like you need to add it to your finds,

Bindmodel to binded model? Cakephp

删除回忆录丶 提交于 2020-01-06 04:54:06
问题 I bind ProductsPhoto to children using bindModel method: $this->Category->bindModel(array ('hasMany' => array( 'ProductsPhoto' => array... How can I bind ProductsPhoto to every product item? Or maybe any other solution suggestion? 回答1: in your controller ,write below code $this->ProductsPhoto->bindModel('hasMany' => array('Product.productphoto_id' => 'ProductPhoto.id'); in your ProductPhoto model, var $hasMany = array( 'Product' => array( 'className' => 'ProductPhoto', 'foreignKey' =>