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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:41:13+00:00 2026-06-17T12:41:13+00:00

I have looked through containable component and other questions here, but doesn’t look like

  • 0

I have looked through containable component and other questions here, but doesn’t look like that can help me.

Basically, I have paginate set to 1, which returns me something just like

Array
(
[0] => Array
(
    [ModelName1] => Array
    (
        [id] => 83
        [parent_id] => null
        [field1] => value1
    )

    [AssociatedModelName1] => Array
    (
        [id] => 1
        [field1] => value1
    )

    [children] => Array
    (
        [0] => Array
        (
            [ModelName] => Array
            (
                [id] => 42
                [parent_id] => 83
                [field1] => value1
                [field2] => value2
                [field3] => value3
            )

            [AssociatedModelName] => Array
            (
                [id] => 2
                [field1] => value1
                [field2] => value2
                [field3] => value3
            )

I am able to limit the output of ModelName1 and AssociatedModelName1 ‘s field by adding

$fields => array("ModelName1.field1") 

to the setting array. In fact I pass this to the “column” of the DataTable Plugin’s component initialization, but it should be the same.

However, since there are SO MANY CHILDREN, and each children contains a lot of fields, I would like to get only the “field2” of each children.

How can I achieve that? If I specify “Children.ModelName1”, I get a SQL1054 error, which is column not found.

Any clue?

  • 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-17T12:41:14+00:00Added an answer on June 17, 2026 at 12:41 pm

    You must use a conditional array in one way or another:

    $this->paginate['Model'] = array(
        'contain' => array(
            'ChildModel' => array(
                'fields' => array('ChildModel.field1', 'Childmodel.field2'),
                'ChildChildModel' => array(
                    'fields' => array('ChildChildModel.field1', 'ChildChildModel.field2'),
                )
            )
        )
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked through here and I realize it doesn't look like getJSON returns
i have looked through other related questions but none of them giving me right
I have looked through the other questions on here, and on other forums. The
I've looked through several posts but I haven't quite found any answers that have
I have looked through a number of tutorials, but I still can't figure out
i have looked through other scanf posts but i cant seem to find the
Okay, So I have looked through all the other questions around trigger not working.
I have looked through various answers here, but am still unable to figure it
I have looked through lots of similar questions, and I have found out that
I have looked through many tutorials, as well as other question here on stack

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.