Category Archives: CakePHP

A note on $form->dateTime(‘field_name’) generating offset warning in CakePHP

This is a note on $form->dateTime(‘field_name’) generating offset warning i.e. “Notice (8): Undefined offset: 1 [CORE/cake/libs/view/helpers/form.php, line 1836..“. If your “date” form field in a view is generating a similar warning you may need to look into the following scenario. Continue reading

A tip on CakePHP find list with related model conditions

You will need to add recursive=>(value) to the $params when you need to get a ‘list’ of table items using related model conditions.

Referring to the example depicted here, let’s say you perform the following query: Continue reading

An example of Google Checkout Integration in CakePHP

NOTE: You will have to make changes into the component code in order to get it working with you application. This is only a sample component and it should not be taken as a plug-and-play kind of component.

NOTE: Download the latest Google Checkout library files from here. After downloading it from this link you will have to make changes to component code where you “include” vendors files following the new file naming structure Google have laid there. As an alternate, I have attached vendors/google files with the new zip archive (This is an OLD one, it’s when i did this) but i would strongly recommend the use of new google checkout library.

I am posting an implementation of Google Checkout payment gateway in CakePHP which i had implemented an year ago in one of my client’s website. The implementation was based on the use of vendors and components. I placed all google checkout files in “app/vendors” folder and created a component to process transactions. The file structure of vendor file was something like the following: Continue reading

A note on difference between app:import and loadmodel in CakePHP

Posting for, someone searched for terms “cakephp what is the difference between app:import model and loadmodel” and “cakephp what is the difference between app:import and loadmodel” and landed on my blog page but unfortunately i could not provide the answer that time, perhaps. I hope it helps future visitors with similar queries. Continue reading

SQL dump file for CakeDC comments plugin for CakePHP

If they (CakeDC people) don’t have complaint of any kind or whatsoever i would like to post the SQL dump code for comments table used in CakeDC comments plugin. Especially, those having problems with generating database table or query through cake console could find this sql dump useful. But, before using this dump, please try to compare it with the latest schema file that could be found in config/schema.php file of the plug-in, it is possible that they might have altered the structure of the table in the meantime (It is Nov 02, 2010 today), so please use it at your own risk. Continue reading

Auto linking text string having image tags using Text Helper in CakePHP

Recently I found that auto linking urls and emails of a string having image tags within was not possible using text helper in CakePHP. It would try to autoLink url of image src and thus it is broken. I am not sure what the issue is in including a fix or solution which could avoid image tags while auto-linking. Then, perhaps you would have to consider other tags like object src and video urls etc. In fact it would be too tedious to handle all kind of html tags and so and so.. Continue reading

Field type tinyint(1) would not save values other than 0 and 1 in CakePHP

Just a quick note. I had a “is_active” field in my users table which i had been using to store boolean 0 and 1 values. Later, i mean today, i decided to save a new value -1 to this field but when i did try, it would’t save -1 and would always save it as 1. After looking at a few blog posts around the web i found that in CakePHP every time you try to save a value other that 0 or 1 into a tinyint(1) field it would save it as 1 (as according to Nate, Continue reading