I have the following in my AppController:

```
function beforeRender()
{
    $this->set('user', $this->Auth->user());
}

```

and then I show the user info like so:

`<?php echo $user['User']['username']; ?>`

but it gives an error:

`Undefined index: User [APP/View/Layouts/default.ctp, line 46]`

I'm using CakePHP 2.0. What's causing the error?

Thanks

**EDIT: Doing `$user['username']` fixes the issue but this isn't ideal as I NEED to declare the model as I want to access other information that is linked e.g. `$user['Profile']['firstname']`**

If I `debug($user)` I get the info but not in the correct way as I'm not able to specify the model and get the relationships (which do work as I use them elsewhere).

My relationship SHOULD BE:

```
Array
(
    [User] => Array
        (
            [id] => 6
            [username] => cameron
            [password] => 3b8cdb0c849f00f3634d9b29def1dac4e9235795
            [email] => cameron@driz.co.uk
            [status] => 0
            [code] => ea817b572e5199698274c7c0d61ee150
        )

    [Profile] => Array
        (
            [id] => 1
            [firstname] => Cameron
            [lastname] => Drysdale
            [gender] => Male
            [dob] => 1987-06-26
            [bio] => <p>I'm the developer of this application.</p>
            [user_id] => 6
            [User] => Array
                (
                    [id] => 6
                    [username] => cameron
                    [password] => 3b8cdb0c849f00f3634d9b29def1dac4e9235795
                    [email] => cameron@driz.co.uk
                    [status] => 0
                    [code] => ea817b572e5199698274c7c0d61ee150
                )

        )

)

```

but when I try and get the logged in user info I only get the first array