cakephp-1.3

saveAll() inserts new row instead of updating

假装没事ソ 提交于 2019-12-12 16:26:09
问题 I'm trying to update a record with CakePHP SaveAll() method but however, it adds new row instead of updating it. My model are as follow: A Store hasOne Map class Store extends AppModel { var $name = 'Store'; var $hasOne = array( 'Map' => array( 'className' => 'Map', 'foreignKey' => 'store_id', 'dependent' => true, 'exclusive' => true ) ); } My edit form has a Store ID (hidden field) to tell CakePHP to update a particular record only. <?php echo $this->Form->input('Store.id'); ?> <?php echo

Unable to access PhpMyAdmin when cakephp in installed in the server

纵然是瞬间 提交于 2019-12-12 13:35:12
问题 I am trying to transfer my codes from localhost to a live domain. The directory of the server is like this: -www.example.com --app --cake --vendors --plugins -- phpMyAdmin -- htaccess Since cakephp deals with the URL, when i try to access www.example.com/phpMyAdmin, cakephp complains that "PhpmyAdminController could not be found". I tried to change the htaccess in the app/webroot/htaccess to allow url of phpMyAdmin but it does not work. Can someone help? I followed the tutorial from the

Different session timeouts for admin and users in CAKEPHP 2.0. is it possible?

自古美人都是妖i 提交于 2019-12-12 13:34:34
问题 I am using cakephp 2.0 for developing a website. Site will contain only 2 types of users. Admin and users(customers). now I need to set session time out 10 minutes for customer and 1 hour for admin. is it possible ?. My core.php file contains the line like this, Configure::write('Session', array( 'defaults' => 'php', 'cookie' => 'xyz', 'timeout' => 10, 'checkAgent' => false, )); 回答1: It is more correct you do this condition in the AppController than to change your core.php this magnitude. You

Effective management of data changes

自古美人都是妖i 提交于 2019-12-12 07:46:26
问题 I have a table called Bookings. This table contains data representing a booking made for a particular service, with many variables. A while ago I came across a problem with my current data structure whereby any changes to the booking that affected times, dates or prices would affect other associated financial records, bookings lists for dates etc. My solution at the time was to create a Modifications table which would track any changes made to a Booking. Then, whenever the Booking model was

fetch only 'enabled' records from the database in cakephp v1.3

落花浮王杯 提交于 2019-12-12 05:33:47
问题 Is there any way of fetching only those records of a model which have 'status = 1' in cakephp v1.3 ? I have created a field named 'status' in every table of my web application. I have a model named 'Message'. What I want is that only those messages are displayed, included in search results which have 'status = 1'. Messages with a 'status = 0' won't be displayed and won't be included in search results too. Please help me if I can do it the cakePHP way, for now as a temporary solution I am

Zend Gdata Calendar Bad Request Error

旧巷老猫 提交于 2019-12-12 04:47:35
问题 I've been trying to work wit the ZEND GData API in CakePHP and have it setup and retreiving a list of calendars. All of that works, however when I try to retrieve calendar events, I get a bad request error and I am not sure how to solve it. Here is the code followed by the error message received when the script is run. * NOTE: I AM TESTING THIS FROM MY MACHINE USING XAMPP //GET LIST OF EVENTS $index = 0; foreach($listFeed as $list) { $query = $service->newEventQuery($list->link[0]->href); //

Use of undefined constant DATE_RFC2822

为君一笑 提交于 2019-12-12 04:39:54
问题 I'm trying to send emails with the cakephp mail component. This is working well but I got this notice in debug mode: Notice (8): Use of undefined constant DATE_RFC2822 - assumed 'DATE_RFC2822' [CORE/cake/libs/controller/components/email.php, line 599] It's pretty embarassing since emails have no "send date" when received. I haven't modified anything in this component or in any file of the cakephp core (except the configuration files obviously) Any idea? 回答1: Okay, this constant is used to

stubs, dynamic homepage in cakePHP

一个人想着一个人 提交于 2019-12-12 03:55:51
问题 I'm working on a site for a client that wants to be able to update modifying their content. The brief was to allow them to edit pages, but not create or delete them. For the site I decided to work with cakePHP, as I've heard good things. First up, a quick explanation of my setup. I've got a single table, called 'contents', in which i'm storing each page's content. The table has a pid, a varchar 'title', a varchar 'slug' and a longtext 'body'. They're all pretty self explanitory, Each page

something wrong with this find statment cakephp 1.3

血红的双手。 提交于 2019-12-12 03:19:31
问题 i use two find statment..the first to fetch articles and the second to fetch comments that related with this articles...i see this error when use my code like this Content: Notice (8): Undefined index: Article [APP\views\articles\view.ctp, line 27] Created Notice (8): Undefined index: Article [APP\views\articles\view.ctp, line 31] Notice (8): Undefined index: Article [APP\views\articles\view.ctp, line 73] articles_controller.php function view($id=null) { $article = $this->Article->find('all',

CakePHP - Updating multiple tables at the same time

时间秒杀一切 提交于 2019-12-12 02:45:17
问题 I have a Cakephp 1.3 app working and I have the following setup: A table called emissions with this model: class Emission extends AppModel { var $name = 'Emission'; var $displayField = 'name'; } And a table called emission_messages with this model: class EmissionMessage extends AppModel { var $name = 'EmissionMessage'; var $belongsTo = array ( 'Emission' => array ( 'className' => 'Emission', 'foreignKey' => 'emission_id' ) ); } The emission_message table has a field called emission_id for the