In CakePHP, I'm trying to build a $hasOne relationship, but I can't add a foreign key to the tables (for legacy reasons). Is there any way I can create a join table (object1_object2) and link them together like this? I want to leverage Cake's powerful object relationship functionality, so if there's a way I can make this custom associa...
Using CakePHP 1.3, I post a form which correctly fills in $this->data. According to the docs, it seems like $this->params['form'] should be populated with some information as well, but it's simply an empty array. Is there a particular reason for that?
The form is built using the Form Helper, as follows...
Some relevant code:
$defaul...
Hello I have a select element which has a few options. I am able to get the selected option when an onChange event is fired. Now I need to pass that option text to php, either with pageload or ajax.
echo $form->select('data_source_select',$dataSourceOptions,null,array('escape'=>false, 'empty'=>'Select One','onChange'=>'getData(this)'));...
Hello I need to retrieve data from database via an ajax call. I am unable to find any good resources for this. Any help would be great. Thanks
...
Hi,
I am very new to the OpenID logic, so please excuse me if I am asking something trivial. I am using the OpenID component for CakePHP by Cakebaker, with the PHP OpenID library by JanRain.
It's all working quite well, but I could not find an exhaustive way to retrieve user informations depending on provider and method (sreg vs. ax). ...
I want to use CakePHP to pull an array of photos from a database, sorted by photo title (0, 1, 2, 3...) My query currently looks something like:
$ss_photos = $this->Asset->find('all',array(
'conditions'=>array('kind'=>'photo'),
'order'=>'title'
));
Unfortunately the titles seem to be in string format, leading to an undesirable s...
Using CakePHP 1.3, I have a (working) form that has dynamically created form fields (via Javascript). Everything works great, multiple models are saved via saveAll(), and it's just beautiful.
But, I get black-holed to a 404 whenever I enable the Security component (hoping to get some of the auto-magic CSRF protection).
I understand t...
I have a cakePHP application that is pulling data from two different databases, which store dates and times in their data from different timezones. One database's timezone is Europe/Berlin, and the other's is Australia/Sydney. To make things more complicated, the application is hosted on a server in the US, and times must be presented to...
if 1 cookie is create by $this->Cookie->write('Rating', $cookie, true, '+1 months');
after 15 day, I read :
$this->Cookie->read('Rating');
do somthing .... this
$this->Cookie->write('Rating', $cookie, true, '+1 months');
Then now expire of rating cookies is 15 days or 1 month ?
...
I want to create a route something like:
http://images.example.com/[models]/[sizes]_[filename].[extension]
[models] = (blog|event|user)
[sizes] = (t|s|l|o)
[filename] = example
[extension] = (png|gif|jpg)
How do I create the route for this? I've tried the following w/ no success:
Router::connect('/:model/:size\_:filename.:extens...
Hi i am new in cake php and can't solve the problem. The problem is I have a table like;
id varchar(16)
parent_id varchar(16)
text text
user_id bigint(20)
is_deleted_by_user bit(1)
is_deleted_by_us bit(1)
who_deleted bigint(20)
who_answ...
Hi,
In my CakePHP aplication, I use a shell script with a cron job which is working perfectly, except when it comes to call the requestAction() function.
Thanks to my logs, I can see it going to the proper Controller->beforeFilter() function, but after that nothing happens. It neves goes into the specific function.
I tried to output $t...
Hi,
i am in a situation where i need to fetch data from 6 models. i can't use associations as they are not related. So what should i use $uses or request action or any other solution
...
Hello, I have a ACL+auth driven app. Everything works fine but I discovered that user is logged out after a random period of time. After doing some research I discovered that the cookie set once doesn't change it's expiration date on page refresh. So it goes like this:
I set up manually expiration time to 1 minute (Security.level low (...
I need to have a subquery order a table before joining so that when I group the table, the proper collapsed data is shown. For the example query, I want the latest start time before a given datetime (2006-08-26 00:00:00)
select * from
parts p left join
(select * from
transactions t
left join
transactiondetails td
on(td.transaction_...
I'm having some trouble working out how to do comparisons on a datetime field, in the course of a CakePHP query.
I want for instance to be able to periodically delete all records from my database that relate to an event that occurred in the past. But I haven't gotten much further than:
$this->Item->deleteAll(
'conditions'=>array('da...
Can some one optimize this mysql query
SELECT submittedform.*, inspectors.first_name, inspectors.last_name
FROM (
SELECT `dinsp`,`departure`,`arrival`,'cabin' as type FROM cabinets
UNION
SELECT `dinsp`,`departure`,`arrival`,'cockpit' as type FROM cockpits
ORDER BY `date_of_inspection` ASC
) AS ...
Hi I want to be able to generate a list using find so that I can use in select helper. but there is a problem. i want too fetch id,name(first + last). so how can I achieve it. I want first_name and last_name to be joined as name . How can I achieve it.
$this->User->find('all',array('fields' => array('first_name','last_name','id')));
I...
Hi all,
I have a table like this:
CREATE TABLE `availabilities` (
`id` int(11) NOT NULL auto_increment,
`structure_id` int(11) NOT NULL,
`day` date NOT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
)
I need to create a calendar which would let me change the status of each day, i.e., set the status of each structure to...
My users need to upload large amounts of files to a site (only HTTP access). Also, no matter how much I tell them to shoot the pictures in low resolutions they keep coming back with Massively sized images. Obviously, they complain that it takes them to long to upload all the files thru a simple HTML form - I'm planning on switching to SW...