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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:37:05+00:00 2026-06-17T06:37:05+00:00

I have a model without a db table used to display information that is

  • 0

I have a model without a db table used to display information that is stored in a session.

I am able to display the content in the session which was loaded from a given table using

$ids = Yii::app()->storedData->getIds();
foreach($ids as $id) {
echo 'ID '.$id .'<br />'; 
} 

Instead of displaying the Ids I would rather display information from a related table of the table from which this info was loaded into the session.

To help explain what I am after, given:

enter image description here

I have ModelC to display session data that is loaded from TableA. Currently with the code above the returned values are TableAId. I would rather display TableB:Description instead. How can I go about doing this without just loading that Description value into the session data too?

  • 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-17T06:37:06+00:00Added an answer on June 17, 2026 at 6:37 am

    I’m not entirely sure what you’re after but if you want to be able to do:

    echo $modelC->description;
    

    And have the TableB description returned, just use a getter on the ModelC class:

    class ModelC extends CModel{ // confusing ?
        public function getDescription(){
             return ModelB::model()->findByPk($this->tableBId);
        }
    }
    

    Is that what you were after?

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

Sidebar

Related Questions

I have a table displaying items. Each cell has a button that is used
I use backbone.js and have a model without a collection. In the view I
I want to have a Backbone model with float attributes in it but without
I have model with a location, which itself has a latitude and longitude. What
I have model Foo which has field bar. The bar field should be unique,
I have model Article it has field title with some text that may contain
I have a Model which I am using to track permissions in a hierarchical
I have a regression model in which the dependent variable is continuous but ninety
Learning php! I have a sql database which contains a table called 'images' which
Here is my model_users class (the model it extends from doesn't have anything yet

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.