cakephp

How do I find the following data

I,m using two tables (regions and safaris) having many to many relationship. the tables are joined by another table called regions_safaris (with the fields - region_id $ safari-id). I want to fetch all safaris meeting a given criteria like durations of 5 days and in a given region. This should be implemented in cakephp ...

How can i implement this in cakephp

Pls help me implement this in cakephp table safari: id name duration table region: id name table regions_safaris: safari_id region_id select s.name from region r, safaris_regions sr, region r, safari s where r.name='yourRegion' and sr.region_id=r.id and s.id=sr.safari_id and s.duration=5; ...

How can i implement this in cakephp

How can i do this in CAKEPHP: I,m using two tables (regions and safaris) having many to many relationship. the tables are joined by another table called regions_safaris (with the fields - region_id $ safari-id). I want to fetch all safaris meeting a given criteria like durations of 5 days and in a given region. This should be implemented...

How do you make your model's database portable in cakephp?

I'm not very familiar with cake.. So here's my questions.. we're developing an app on mysql, but it may eventually need to deploy to mssql or oracle. How do we make sure that we won't have strange problems with our primary keys? In mysql they are AUTO INCREMENT columns but IIRC in oracle you need to use sequences... is there a way to mak...

Where should I put this method in an MVC architecture?

I am writing an application using CakePHP and I am unsure as to where I should be putting my generateMapUrl function. function generateMapUrl($id = null) { if ( !$id ) { $this->Session->setFlash('Invalid Property Id'); } $this->read(null, $id); $url = "http://maps.google.com/maps?oi=map&q="; $url .= ...

cakephp - best way to make a dynamic menu

I want to display a menu on every page that is run from a database. Using just down and dirty php thats easy but I want to integrate it with cakephp using their MVC system. Now my question is how is the best way to go about this? My thoughts are to make an element with the layout and then a component or controller for all the logic. ...

Why is the CakePHP authentication component not hashing my password?

I'm using CakePHP 1.2 with Auth and ACL components. In my user register action, the password is coming in unhashed. Specifically, this expression: if ($this->data['User']['password'] != $this->Auth->password($this->data['User']['confirm_password'])) This is evaluating to true, even when I submit identical values for password and...

What is the best way to create global variables in CakePHP?

I'd like to create a global variable in CakePHP. If I define something in in my app_controller.php like var $varName I can access $this->varName from any of my controllers, but I cannot get to it from models. How can I create a global variable accessible from the models? The value of $varName isn't known until runtime, so I don't...

Does CakePHP have the ability to prevent double / duplicate form submissions?

I discovered the Security Component in CakePHP helps to prevent CSRF by adding tokens as hidden values to forms. What I was wondering is if there was anyway to prevent duplicate form submissions using this Component or some other component/helper? In previous projects, I used a unique hash saved in a session, which is read then deleted...

How do I use multiple foreign keys in one table referencing another table in cakephp

Using cakephp, I have a generic address table, which I want to link to customers, vendors, contacts. most of the tables only have a 1 to 1 relationship, but I want my customers table to have 2 perhaps for clarification: I have a customers table id, int mailing_address_id, int billing_address_id, int and an addresses table id,int add...

How to implement a cross-domain Ajax request using CakePHP and jQuery?

I am using CakePHP for my project, and I am generating XML views so that I can interact with them (CRUD) from an external website. There is authentication required on the CakePHP website. Essentially, I want to view "http://mycakeapp.com/posts/views/1.xml" from "http://www.example.com" However, I get this error when using jQuery's aja...

CakePHP Tables without an 'id' field

How does CakePHP deal with tables that don't have an id column? I'm trying to save some relationship data, but Cake wants to "SELECT LAST_INSERT_ID()", however the table that it's trying to save to does not have the id column so the id is for a different table. Specifically, I've got tables for "Games" and "Players", and a relationship...

How can i get a wildcard list in a CakePHP scaffolding?

I've got a scaffold built for CakePHP, but need to have a way for users to type in part of a surname into a text box, click a button and for the list of people to be filtered to a wildcard search. I'm struggling for example code. Does anyone have some? ...

Model won't update

Using cakephp: I am trying to update customer information and the address the customer is linked to. such that Customer.address_id = Address.id, and Customer Model $belongsTo = 'Address'; From the customers_controller function profile($id = null) { if (empty($this->data['Customer'])) { $this->Customer->id = $id; $thi...

Missing Table with Simpletest in CakePHP

I'm using cakePHP and am using Simpletest as the testing suite. Whenever I run tests on the models, I get an error: Missing Database Table Error: Database table account_types for model AccountType was not found." (For whatever) Does anyone know how to fix this problem? My guess is the fixtures are not being created or something alo...

how to map enum with the string or viceversa in order to save into database??

I have in my database a coloumn say agent which can have enum values ('G','Y','M') where G= google Y= yahoo M= msn how should i map the output coming from my function i.e google as G in my code so that database recognise it and saves it?? ...

Any support for optimistic locking in CakePHP?

I'm just starting out with CakePHP, and I can't find any support for implementing an optimistic locking scheme. The closest I could find was a comment on this CakePHP blog post saying that it wasn't supported in June 2008. Does anyone know if that has changed, or if someone has published an extension or a tutorial on how to implement it...

dynamic tables in cakephp

Can I create tables in the database dynamically with the columns created based on the values entered in a web page? Actually I need to create an application that users can use for creating forms and templates,get data from others by mailing the link and store them in the database. Each user may create a different form with different fie...

Sending mail through PHP

I'm trying to sends mails in PHP. The code I used for sending a mail in CakePHP is given below. I get the message 'Simple Email Sent' in my web page but the mail is not delivered to my inbox. Am I missing something? The values in the to, subject and link fields are set with the values entered in the user interface. $this->set('to'...

Determine whether a user is a developer of a facebook app.

I'm looking at ways to secure the admin section of my (cakephp powered) Facebook application. To avoid duplicating functionality, I thought it'd be neat to allow access to people who have been flagged as developers in the app settings. The question could then be: How do I determine whether a user of my Facebook application is a develope...