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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:55:07+00:00 2026-06-11T06:55:07+00:00

I have read the guide on CakeBook about the Containable array. class Post extends

  • 0

I have read the guide on CakeBook about the Containable array.

class Post extends AppModel {
    public $actsAs = array('Containable');

The result is:

array(
    (int) 0 => array(
        'Post' => array(
            'id' => '1',
            'title' => 'This is the first post',
            'slug' => 'this-is-the-first-post',
            'body' => 'body body 111body body 111body body 111body body 111body body 111body body 111body body 111',
            'image_id' => '0',
            'language' => 'sv',
            'translation_id' => '0',
            'created' => '2012-09-03 17:45:57',
            'modified' => '2012-09-03 19:12:21'
        ),
        'Image' => array(
            'id' => null,
            'name' => null,
            'url' => null,
            'alt' => null,
            'description' => null
        ),
        'Asset' => array(),
        'Readmore' => array(),
        'Reference' => array(),
        'Category' => array(),
        'Course' => array(),
        'Tag' => array(),
        'User' => array(
            (int) 0 => array(
                'password' => '*****',
                'id' => '2',
                'username' => 'test0',
                'fullname' => 'Test Test',
                'url' => '',
                'email' => '',
                'role' => 'admin',
                'phone' => '+',
                'created' => '2012-09-03 17:44:22',
                'PostsUser' => array(
                    'id' => '1',
                    'post_id' => '1',
                    'user_id' => '2'
                )
            ),
            (int) 1 => array(
                'password' => '*****',
                'id' => '1',
                'username' => 'test1',
                'fullname' => 'Frank',
                'url' => '',
                'email' => '',
                'role' => 'admin',
                'phone' => '',
                'created' => '2012-09-03 17:41:25',
                'PostsUser' => array(
                    'id' => '3',
                    'post_id' => '1',
                    'user_id' => '1'
                )
            )
        )
    ),

But it doesn’t work to print out specific parts of the array. So if I in the index view for Post, I write:

echo h($post['Post']['title']);

everything is fine, but when I try:

echo h($post['User']['fullname']); 

it doesn’t work. I get the point, that I have to loop through the Users when I have a hasmany and belgosto relation between post and user.

So how can I print all users associated to a post?

  • 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-11T06:55:07+00:00Added an answer on June 11, 2026 at 6:55 am

    Thanks! I found a solution to it. I was a bit careless, I tried a solution to do it manually before and added a PostUser model and a controller for that model. Deleted them and everything works fine. Cake magic works again.

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

Sidebar

Related Questions

I have read Apple Scroll View Programming Guide for iOS but still confused about
I have read many answers to questions about dynamically resizing NSWindows and nothing has
I have read few articles about table partioning but still I am bit confused
I have read the following rails guide : http://guides.rails.info/active_record_querying.html in there exemple a client
I have read about zxing library but have no experience on that, also is
Basically I have read the git merge conflicts guide, and I'm not sure it
I am new to SCOM, but I have read a lot about it and
I have read http://developer.android.com/guide/practices/screens_support.html and http://developer.android.com/reference/android/util/DisplayMetrics.html and I somehow left with a gap here.
I have read the screen support API guide (http://developer.android.com/guide/practices/screens_support.html) and much more resources, but
I have read the Core Animation Cook Book and Core Animation Programming Guide from

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.