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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:12:56+00:00 2026-06-09T11:12:56+00:00

I have the database just like this ==== cis_policy_registration==== id policy_id email_id policy_start_date ====

  • 0

I have the database just like this

==== cis_policy_registration====
id
policy_id
email_id
policy_start_date


==== cis_policy_family_details===
id
policy_id
is_main_applicant
firstname
lastname
gender

Now how to make the relation between models with the policy_id (both tables),
I want to take firstname and lastname in registration model and check is main applicant

that must list in CGridView

who can solve this problem

thanks in advance

  • 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-09T11:12:58+00:00Added an answer on June 9, 2026 at 11:12 am

    The relation between these two tables should be handled from the “main” model (Policy), so in Policy model class you should have:

    'policy_reg' => array(self::HAS_ONE, 'PolicyRegistration', 'policy_id'),
    'policy_details' => array(self::HAS_ONE, 'PolicyDetails', 'policy_id'),
    

    And then:

    $policy = Policy::model()->with(array('policy_details'))->findByPk($pk);
    $policy->policy_details->is_main_applicant;
    ...
    

    And in CGridView you can print the relational value like this (after sending CActiveDataProvider object from Policy model):

    'policy_details.firstname'
    

    or

    array(
        'name'=>'Firstname',
        'value'=>'$data->policy_details->firstname',
    ),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the database just like this ==== Invoices ==== id customer_id description ====
I have a database like this: table pepak, table category, table subcategory I just
i have rows of text like this in database: row1 -> text text!? sometext..!
I have a database table like this: wagetable name lowhours highhours wage Default 0
Let's say I have a database like this: Users ----- ID int PK Identity
I have a little bit of code that looks just like this: function StrippedExample(i1,
I have a database that looks like this: ID parent ticket category _record_status _log_user
I have a database table like this: id | check_number | amount 1 |
I have a database which contains an Assignment table. The table looks like this:
I have a table (in an Oracle database) just like below: department ---------- Finance

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.