cakephp

CakePHP: Need help using saveField to update a fields in a belongsTo model.

I am trying to update a password into two different models/tables in CakePHP. I can update it fine in the parent model, but not the second model. Models: Users (hasOne GameProfile) PK=id Gameprofiles (belongsTo User) FK=user_id Here is a stripped down version of my function in the Users_controller.php: function updatepass() { if (!...

Using Cron with Cake Console on Ubuntu

I need this cron job to execute my shell just as it does when I run it on the command line. I read through the one other question I found about this, but my console-based cron job still is not working. I want to post some code and what it outputs, maybe someone can tell me what's going on. First off, this is on Cake 1.3. I am running o...

CakePHP not setting the $this->Model->id variable

I am currently trying to access the data that was just inserted using: if($this->User->save($this->data)) { $user_id = $this->User->id; #119 ... But I get the error: Notice (8): Undefined index: id [APP/controllers/users_controller.php, line 119] Code | Context if($this->User->save($this->data)) { $user_id = $this->da...

Cakephp looping through database saves, for some reason it only saves on the last instance of loop?

I'm trying to get this loop to save a new record to the database in cakephp on each iteration but for some reason its only saving it on the last one (so in this case it saves a record called "test9" but no others.. this type of save has worked for me so far in cakephp and I am completely stumped by this, I would appreciate any advice Th...

Routes configuration for named arguments in CakePHP

Hi, In my Cake application I have a controller "completed_projects". Its index action takes no arguments and lists some projects. Different pages can be accessed by example.com/completed_projects/index/page:23 etc. I want to make the url's like this: example.com/portfolio/page23 Obviously I need to make some routes for this. I've tri...

How to create new records in multiple tables at the same time ?

Hello all, I was wondering how can I implement a view that allows the user to enter multiple(unknown) number of records in related models.. for example, I have two models called groups and users. And I want to implement a view that allows me to create a group ( which is easy ) and in the same view let me create multiple number of users...

cakePHP routing help

Hello folks, Here I am trying to route a page without showing its action in URL, Eg: URL is http://localhost/brands/1/xyz Router::connect( '/brands/:id/:name', array( 'controller' => 'brands', 'action' => 'index', 'id' => '[0-9]{1,}', 'name' => '[a-z]{1,}' ) ); it works fine.... But I nee...

How to create cron in cakephp?

Please give me proper step in carted cron............. ...

What is the best way to decalre a global variable in cakePHP

Hi all, I am learning cakePHP 1.26. I got a Controller which got two functions. I was thinking to make $myVariable a global variable so that both functions in the controllers can share it, but I am not sure if this is the best way to declare a global variable in cakePHP: class TestingController extends AppController { var $myVar...

Cakephp, retrieve only certain number of rows from database?

I don't know if I'm missing something, or what, but I've been looking over the cakephp cookbook a lot lately and I don't think I have figured a way from it to get "x" number of rows (say 100) based on criteria.. right now I'm just using the find method to get all rows and then using my php controller to make use of only the ones I need, ...

CakePHP Searchable Plugin of Neil Crookes

I have a problem with the routing while using the Searchable Plugin of Neil Crookes. When I search for something the URL looks like this: http://localhost/search/All/sunshine But now all the other links have the name of the plugin in their URL. For example this: $html->link(__('News', true), array('controller'=>'news', 'action'=>'index...

CakePHP, injects "LEFT JOIN" (mentioning fields in an associated model) into my update attempts

This is driving me crazy, I am trying to do something like: $this->data = $this->Prox->read('proxy',$currentgetdata); $this->data['Prox']['checked'] = 2; $this->Prox->save(); where I have a model association of: class Prox extends AppModel { var $name = 'Prox'; var $primaryKey = 'id'; ...

Can not insert data by the function saveAll with many model

Hi All, I have a problem related to the function "SaveAll" in cakephp 1.2+ as the following: I have 3 models: A, B, C that the relation is: A belongTo B B hasOne A B belongTo C C hasOne B Above it means A,B,C all relation is 1-1 I have a form that includes all field of A,B,C to create new A,B,C. When saving, I can't create new ...

CakePHP, setting recursive to -1 for a model so it doesn't do "joins"?

I have 2 models that are associated but don't want it to use joins when I make database updates.. from the cakephp cookbook, I can't quite gather how I am supposed to set "recursive" to -1, also, do I do it for the model that has the association, the other one, or both such as if model1 "belongs to" model2 and I am trying to make it so...

How can I retrieve data in hasMany relationship?

Hi, I have a built a cakephp application. I have two models one is groups and other is users groups hasMany users users belongsTo Groups in my users table I have group_id column which displays the group id to which the user belongsto. (user can only belongto one group) Now if I want to display count of all users in particular groups...

Modifying view based on ACL in CakePHP

I want to be able to show or hide certain elements in a view based on ACL. For instance, if a user is looking at my Users/index view, I don't want to show a 'Delete User' element if he doesn't have permission to delete users. If he does have permission to edit users, I do want to show a 'Edit User' link. I can hack this together, but be...

Legacy URLs in CakePHP using routes or htaccess

I'm in the midst of moving a site from "plain old" php to the CakePHP framework and I need to be able to handle some legacy URLs, for example: foo.com/bar.php?id=21 is the pattern of the current URLs, but in the new site using cake, that URL needs to redirect to: foo.com/blah/21 So basically, I need to be able to grab that ID numbe...

CakePHP and sending emails. Am I doing it right?

I am using CakePHP to write a web app and one of the requirements is to send users' emails after registration. I had to create an email account on our server and then send the emails using smtp authentication, otherwise, google and yahoo (at least) refused to read my emails. Does this come with major trade offs? As in speed of the app or...

Download cakephp manual.

Hi, From where I could download manual of cakephp 1.3 .......? ...

Containable behavior does not return from depth 3 - CakePHP

Hi, I use CakePHP 1.2.6 and have the following relations: Showcase HABTM User belongsTo Galleryitem hasOne Image I try to get all the data related to a Showcase, and therefor also all its users with their Galleryitem -> Image. I use the following query: $showcase = $this->Showcase->find('first', array('conditions'=>array('Showcase...