try the following:

$hasMany = array('Profile');

$belongsTo = array('User');

Cheers

On 22 February 2012 19:02, Miguel Ángel Moreno Armenteros <
[email protected]> wrote:

> Hello, i know this subject comes over and over but I couldnt find the
> solution..
> Im a beginner and iam testing out some scaffolding and so on.
>
> I have Profiles of user and Users, who belong to a certain profile.
> for that i have two tables
>
> users
>    id int not null auto_increment primary key
>    username
>    name
>    profile_id
> .....
>
>
> profile
>  id
>  profile
>
>
> in the models i have this
> profile.php
>
> <?php
> class Profile extends AppModel{
>        var $name = 'Profile';
>        var $hasMany = 'User';
> }
> ?>
>
> user.php
>
> <?php
> class User extends AppModel{
>        var $name = 'User';
>        var $belongsTo = 'Profile';
> }
> ?>
>
>
> and the controllers
>
> profiles_controller.php
> <?php
> class ProfilesController extends AppController{
>        var $name = "Profiles";
>        var $scaffold;
> }
>
> ?>
>
> users_controller.php
> <?php
> class UsersController extends AppController{
>        var $name = 'Users';
>        var $scaffold;
> }
>
> ?>
>
>
> and when i open /localhost/.../users/add
>
> in the formulary it scaffolds, the select field for profile is
> empty... so it doesnt recognize the association...
>
> can anyone help me with this basic thing??? I checked other examples
> and they are like mine!
>
> thank you
>
> PD: In the database i have some sample profiles already....
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to