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 6376205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:42:55+00:00 2026-05-25T01:42:55+00:00

I am totally stuck now with containable behavior. In my model User everything works

  • 0

I am totally stuck now with containable behavior. In my model User everything works just fine and I get everything I need:

    $this->set(
        'user',
        $this->User->find(
            'first',
            array(
                'contain' => array('Ad', 'Ad.Placad', 'Ad.Placad.Place'),
                'conditions' => array('User.id' => $this->Auth->user('id'))
            )
        )
    );

outputs:

        Array
(
[User] => Array
    (
        [id] => 1
        [username] => admin
    )

[Ad] => Array
    (
        [0] => Array
            (
                [id] => 1
                [user_id] => 1
                [Placad] => Array
                    (
                        [0] => Array
                            (
                                [id] => 5
                                [ad_id] => 1
                                [place_id] => 1
                                [Place] => Array
                                    (
                                        [id] => 1
                                        [name] => kauf Bk
                                    )
                            )
                    )
            )

        [1] => Array
            (
                [id] => 2
                [user_id] => 1
                [Placad] => Array
                    (
                        [0] => Array
                            (
                                [id] => 6
                                [unique] => 1-2
                                [ad_id] => 2
                                [place_id] => 1
                                [Place] => Array
                                    (
                                        [id] => 1
                                        [name] => kauf Bk
                                    )
                            )
                    )
            )

But this one:

$this->set('ad',
        $this->Ad->find('first',
            array(
                'conditions' => array('Ad.id' => $id),
                'contains' => array('Placad', 'Placad.Place'),
            )
        )
    );

just ignores the Place table.

Array
(
[Ad] => Array
    (
        [id] => 1
        [user_id] => 1
        [name] => bota1
    )

[Placad] => Array
    (
        [0] => Array
            (
                [id] => 5
                [ad_id] => 1
                [place_id] => 1
            )

    )

)

There should be additional array with Place info in Placad, am I right? The first query is working, why the second one is broken? I hope the description provided is sufficient.

Thanks guys!

  • 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-05-25T01:42:56+00:00Added an answer on May 25, 2026 at 1:42 am

    typo: contain, not contains

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

Sidebar

Related Questions

I'm totally stuck why this is happening. The options menu was working just fine,
Totally confused by this one... We have a WAMPServer installation set up, running a
I am totally 100% stuck on this, no answer ever given for timezone support
I'm totally stuck on what is going on when I try to run the
Right, I know I am totally going to look an idiot with this one,
I'm totally stuck. I've got two Controller: Customer and Address. Both have the fields
I am wondering why this framework (QCodo) is almost forgotten and totally unpopular. I've
Ok, I'm a bit stuck on this one, can I actually do what I'm
I'm totally stuck with that, i don't know where to start. I have to
I am really stuck on this with no more ideas to try in mind...I

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.