Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:06:15+00:00 2026-06-15T07:06:15+00:00

In CakePHP’s documentation I’ve seen from version 2.2 has been added the configuration key

  • 0

In CakePHP’s documentation I’ve seen from version 2.2 has been added the configuration key ‘contain’ for the AuthComponent:

The core authentication objects support the following configuration keys.

[…]

contain Containable options for when the user record is loaded.

http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#configuring-authentication-handlers

But I can’ understand how it works (there is no example).

This does not work:

'Auth' => array(
    'authenticate'      => array(
        'Form' => array(
            'contain'   => array('User' => array('id', 'full_name')),
            'fields'    => array('username' => 'email'),
        )
    )
)

Neither this:

'Auth' => array(
    'authenticate'      => array(
        'Form' => array(
            'contain'   => array('id', 'full_name'),
            'fields'    => array('username' => 'email'),
        )
    )
)

Suggestions? Someone tried it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:06:16+00:00Added an answer on June 15, 2026 at 7:06 am

    Contain() is used to contain a DIFFERENT model, not the same one Auth is already retrieving (unless you’re trying to contain other User’s ie their friends or something – but then you’d likely have an alias, and not ‘User’).

    So, an example would be:

    'Auth' => array(
        'authenticate'      => array(
            'Form' => array(
                'contain'   => array('Post'),
                'fields'    => array('username' => 'email'),
            )
        )
    )
    

    Which would then cause Auth to retreive the user’s Posts as well when it retrieves the user’s data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since CakePHP 1.3, the Ajax helper has been deprecated, one cannot user $ajax->Autocomplete.. I
CakePHP has a requireSecure function in the SecurityComponent. I'm using this to force SSL
My cakephp is not loading any css,js. i uncommented the line Configure::write('App.baseUrl',env('SCRIPT_NAME')); in core.php.
In cakephp I want to be able connect to a different database from one
I download cakephp 2.1 from the official website. When I copied files to my
I have a CakePHP model - User - that has ties to an external
CakePHP has the default of unique set to true, I've coded it just to
In CakePHP 2.0 version, I have written something like this in UsersController.php public function
CakePHP has an annoying habit of having very deep, multidimensional arrays when pulling data
In my cakephp i need to retrieve datas from database. how can i display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.