cakephp

CakePHP: Saving a translation saves the translated field in the original table, why?

I'm using Translate behavior. Here's the scenario: I save a translation on model 'Content' with the language Japanese. Then I check the corresponding table 'contents' in my database and I see that my 'title' and 'body' fields are changed to the translated inputs (in Japanese). My English (and Japanese) content is saved in the content_...

CakePHP session/auth logging out intermittently

I'm having reports and complaints from my user that they will be using a screen and get kicked back to the login screen immediately on their next request. It doesn't happen all the time but randomly. I am using CakePHP and the Auth component, which seem to work well other than this issue I got some feedback on the Cake forums once tha...

Checking Model relationships in CakePHP

Is there a way to check CakePHP's model relationships? One model is saving twice on a table and I really suspect there's something wrong with my relationships. Problem is I have a lot of tables so it's really a pain. I'm wondering if there's a more sure and easy way of doing this maybe automatically? Thanks in advance! ...

How do I create a Unary association in CakePhp?

Is there a shortcut for creating Unary associations in Cake? For example, a user is a friend of another user. I'm pretty sure it's going to violate cake's conventions if I try it the hard way and code the associations myself. Cake has HABTM: var $hasAndBelongsToMany = array( 'User' => array( 'className' => 'User', 'joinTable...

CakePHP putting quotes around function name in WHERE clause

I'm using various functions from the earthdistance module in PostgreSQL, one of those being ll_to_earth. Given a latitude/longitude combination, I'm trying to retrieve the nearest point from my database via CakePHP 1.2.5 Stable. // set dummy data $latitude = 30.4393696; $longitude = -97.6200043; // create a simple bounding box in the...

How much "unlearning" when I move to a PHP framework

I'm aware of the benefits of using a PHP framework (not first hand though, just by reading SO, etc.) But what I don't hear about is the amount of "unlearning" a framework requires. When using a framework, you hand control to the new framework and you have to "unlearn" many things and re-learn them the new way as your new framework requir...

Testing website mailing locally

I'd like to test password recovery and similar email related features for a website. I'm using PHP (cakePHP framework) and the syntax seems easy enough but I'm unsure of the email server setup. I've looked around for a good tutorial but they aren't specific enough. What is a quick and easy mail server to use locally? also... some init...

CakePHP and CSRF

I'm new to CakePHP and am wondering how to protect my forms from Cross Site Request Forgery, ie adding a nonce to the forms. I've set the salt in the config file. ...

cakephp stop ajax submit

Hi, Is there a way to stop cakephp ajax submit to stop the submission in case the user has not entered required details and click the submit button. Regards ...

unbindModel call in CakePhp. How does it work?

How does unbindModel happen in cake? $this->User->unbindModel(array('hasAndBelongsToMany' => array('Friend'))); I wrote this in the beginning of a function. But still it queries the 'Friend' model. There was a call to paginate() in the middle of the function. So I thought the paginator might be generating the queries. I did added an ...

cakephp habtm relationship (saving data)

Question related to HABTM has been posted in some good numbers on stackoverflow but I am still looking for a solution to my problem. I am creating an application that allows for creation of topics based on a particular subcategory. While adding a topic the user is asked for tags (on the same form). Now when the user has finished adding ...

cakephp: get values from a "cat" table in the "users_controller.php" file?

Hi i have table "User" and a Controller "users_controller.php" and i have another table called "cateogry", need to retrieve values from this table in the "listall" action(site.com/users/listall). how can i get values from another table. ...

Modifying Containable fields required in beforeFind callback?

In my CakePHP 1.2.5 app, I have a Profile model that belongsTo a User model. The User model has a username field, and when performing a find() on the Profile model, I want to always automatically retrieve the value of User.username too. I figure it would make sense to modify my Profile model's beforeFind() method to automatically conta...

CakePHP mathematic-calculation field?

(Database structure like http://stackoverflow.com/questions/1545764/cakephp-select-default-value-in-select-input) So, I have two tables in CakePHP: Trees, and Leafs. Every Leaf has a tree_id for its corresponding tree. Every leaf also has a numeric value. The default view that I baked for trees just lists all the trees in a table. I...

Can I retrieve an aggregate column via the Containable behavior?

Is it possible for CakePHP's Containable behavior to request an aggregate column value during a find()? For example, in model Item containing numeric columns quarks and cogs: $this->Item->contain('quarks + cogs AS total'); ...

how to upload the File to some location in cakephp

Hi, i am trying to use the File upload feature in my application .. i am having a Form with many fields of type Text,textarea and including File upload FIeld. I have kept a Submit button at the end of the Form which on click will submit the actual value of the textbox /textarea and even the value for the Field of type File upload. Ho...

How to update a jointable in CakePHP, manually

I am sort of a newbie with CakePHP. I have two tables: contacts and tags, and an HABTM table contacts_tags. User should be able to add tags as people can do in delicious.com. they get a list of tags as they type. They can also add new tags just by typing them. I want to check the tags table to see which tags are already present and which...

__call() function in CakePHP?

hi, is __call() function availabe in CakePHP? I used this fucntion in Zend Framework. class UsersController extends AppController { function home(){ /*some action*/ } function __call($m, $p){ print_r($m); print_r($p); } } getting erro like this Missing Method in UsersController <?php class UsersController extends AppController { ...

CakePHP Session vaiable use in view page?

hi i have a varible contaning "username" and want to get these values via session to any of the view page. How can i use session vaible in view ...

Finding a subtree in a CakePHP Tree

In CakePHP, how do you select just a subtree in a model which actsAs tree? I tried this, to find the tree headed by the item with label = "My Label" $this->find("threaded", array( "conditions" => array( "label" => "My Label" ) )); ...however looking at the logs, it runs this SQL: SELECT Menu.id, Menu.parent_id, Menu....