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

  • Home
  • SEARCH
  • 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 7558501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:23:14+00:00 2026-05-30T12:23:14+00:00

I have some related tables and for the main this is the Model: <?php

  • 0

I have some related tables and for the main this is the Model:

<?php
App::uses('AppModel', 'Model');
class Information extends AppModel {
public $useTable = 'informations';
public $displayField = 'name';
public $validate = array(
    'name' => array(
        'notempty' => array(
            'rule' => array('notempty'),
            'message' => 'The field name can not be empty',
        ),
    ),
    'lastname' => array(
        'notempty' => array(
            'rule' => array('notempty'),
            'message' => 'The field lastname can not be empty',
        ),
    ),
    'email' => array(
        'email' => array(
            'rule' => array('email'),
            'message' => 'The email address is not correct',
        ),
    ),
);

public $belongsTo = array(
    'Country' => array(
        'className' => 'Country',
        'foreignKey' => 'countries_id',
        'conditions' => '',
        'fields' => '',
        'order' => ''
    )
);

public $hasMany = array(
        'Education' => array(
                'className' => 'Education',
                'foreignKey' => 'informations_id',
                'dependent' => true
        ),
        'Experience' => array(
                'className' => 'Experience',
                'foreignKey' => 'informations_id',
                'dependent' => true
        ),
        'Attachment' => array(
                'className' => 'Attachment',
                'foreignKey' => 'informations_id',
                'dependent' => true
        )
);

}

I need to get all the data related to a ID but when I try to get the data using this code:

  public function view($id = null) {
    $this->Information->id = $id;
    if (!$this->Information->exists()) {
        throw new NotFoundException(__('Invalid information'));
    }
    $this->set('information', $this->Information->read(null, $id));
}

The information from tables Education, Experience and Attachment is not showed only this info is get:

Array
(
   [id] => 9
   [name] => Reynier
   [lastname] => Perez Mira
   [email] => reynierpm@gmail.com
   [mobile_phone] => 04241805609
   [home_phone] => 02735555899
   [address] => asdas
   [picture] => skills.png
   [other_information] => asdasdasd
   [recruitment_status] => Call for Interview
   [countries_id] => 9
)

Why? I miss something?

  • 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-30T12:23:15+00:00Added an answer on May 30, 2026 at 12:23 pm

    Update your function to set the recursive on Information:

    public function view($id = null) {
        $this->Information->id = $id;
        if (!$this->Information->exists()) {
            throw new NotFoundException(__('Invalid information'));
        }
        $this->Information->recursive = 1;
        $this->set('information', $this->Information->read(null, $id));
    }
    

    Then just make sure all of your relationships in your Information model are setup to point to the other models you want to include.

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

Sidebar

Related Questions

I have a number of tables containing some basic (business related) mapping data. What's
I have 2 tables, one that holds records with some data related to it
I have a NewsStories tables which I'm left joining with some related tables. Each
I have some thread-related questions, assuming the following code. Please ignore the possible inefficiency
I have some confusion related to the .NET platform build options in Visual Studio
I have some concerns related to the fact of testing some functions containing the
I have some security related service running on my machine (start type = automatic)
I have Used Dojo 1.0, but I have some version related questions: When will
I have some C structures related to a 'list' data structure. They look like
I have some questions about using MySQLi queries, and related memory management. Suppose 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.