I have an issue with cake's auth that I simply can't seem to get past (i've been debugging and trying different tutorials for the last two days). As far as I can see it should be very simple, the problem is whenever i try to login, it just refreshes the login page. I cannot for the life of me figure out why! My only conclusion is that th...
Hello,
I'm trying to build an invitation system with CakePHP. I have Invitation model which hasMany People, and Person hasOne and belongsTo Invitation. I believe the relationships are working, since my Invitation index view can properly access and display its associated People through the Invitation model. But heres what the relationship...
I have an app in which Users belong to many Categories. So I have a Users table, Categories and Users2Categories table. The Users2Categories table consists of a user_id and category_id. So I guess the question is: do I create a model for Users2Categories? Ultimately, I would like to be able to "find" User objects and have their respe...
Hello.
I want to receive model data by find(all), but the user should get only a restricted set of table fields. That's easy:
$ret = $this->find('all',array('fields'=>array(
'Employee.id','Employee.address_id'
)));
But this model (Employees model) also has a belongsTo association:
var $belongsTo = array(
'Address' => array(
...
Hello I am using cakePHP 1.3 and I am unable to retreive the last inserted row's id. I actually am using $this->Model->id to retreive the last inserted id but I am unable to get the id. When tried to check what is return type, it says as bool(false), which means nothing is returned.
Here I am loading a different model in a different con...
Hi,
I have a form with two inputs:
echo $this->Form->input('articulo_id', array('empty'=>'---Select---'));
echo $this->Form->input('numeral_id', array('empty'=>'---Select---', 'type'=>'hidden'));
When the first one changes state the second one gets updated and auto-populated; this is how it gets updated:
$options = array('url' => '...
how do i unset this option from a input?
im using ajax to populate this field and after that i need to show it
thanks
...
Hi.
I've been silly.
I have a model called Emails, which I have build alot of functionality for, however now I have come to actually send emails in the emails controller and have hit a wall.
The email component clashes with the model, they are both referenced with $this->Email.
My question is how can I rename the component (going bac...
I have made a helper class called Navigation that gets used on every page because it does stuff to my main navigation menu. So in order for this to work I have included the helper in my pages controller like so:
var $helpers = array('Html', 'Javascript', 'Navigation');
however when there is an error like a missing view or something the...
How do you make validation in CakePHP stop if any single rule fails for any field?
I know about the 'last' property but that only stops validation for that field, I want it to stop completely.
Thanks.
...
Hi,
I've used CakePHP a few times before but this is the first time I'm trying out Bake. On my Mac I'm running CakePHP 1.3, PHP5.3.3, and MySQL. I've created my database tables and the app connects to the database.
I navigate to the console folder. and type ./cake
I get welcome to the CakePHP v.1.3.5 Console. Then I gives me a list o...
Imagine a typical CakePHP application, in which a Controller passes various bits of data to the View using $this->set in the typical way:
class ThingsController extends AppController {
function test() {
$this->set('someparam', 5);
}
}
If the corresponding View was to define and use a small helper function which outputs...
I am trying to use Ajax pagination in CakePHP and have read you can pass the variables along in the URL however I cannot seem to set the route. When I click on next I get an error about the category not existing (because of a custom validation method I created) because the route isn't being followed.
I would like the $paginator->next()...
Is it okay to put some custom validation methods in AppModel and call those from my app's Models? I want phone number validation to work the same for all phone numbers on my site and I want that validation rule to be in one place only. Is there a better way to do this?
...
Hi,
I have a MySQL DATETIME field that holds the date of birth of a user. I want to use that date to display the age the user in years.
Is there a method of the Time core helper to do this?
Also, why when you add a DATETIME field to a form in Cake does it not let you select a date less than 1990?
Thanks,
Jonesy
...
I have a few models which are not in the default cakephp format
user(id, name....)
1 Harsha ...
2 John ....
dishes(id, name, price ...)
1 "Cheese Pizza" 6
2 "Zinger Burger" 3
restaurants (id, name, .....)
1 "KFC" ...
2 "Pizza Hut" ...
module(id, name) values (User, Dishes, Restaurants)
1 "Users"
2 "Dishes"
3 "Restaurant"
i...
I am using an afterFind function to modify data from a find function. It works fine. If I move the afterFind function into a behavior (in a plugin) it still works, but only when the model of interest is the primary model, i.e. it isn't called when the model belongsTo another model. Is there any way round this? I'm using cake 1.3.4. This ...
i have a Search Result like this in an array
Array
(
[0] => Array
(
[StatusMessage] => Array
(
[id] => 1
[pid] => 0
[message] => First Status Message
[item_id] => 1
[commenters_item_id] => 2
...
I am using an Account Controller which doesnt have its own table but uses User Model.
All works fine except - when I validate any form. It says validation fails (when I try to fail the validation to check) but doesnt throw the error below the field
View
<?php echo $this->Form->input('id'); ?>
<label for="UserPassword">Ne...
Let's say that I have a site running CakePHP and I have the prefix "product".
I have lots of pages with URL like:
http://mysite.com/produt/blue-shirt/details
http://mysite.com/produt/blue-shirt/order
http://mysite.com/produt/skate/details
http://mysite.com/produt/sun-glasses/vendors
Now I need to use a domain like http://mysite-blue-...