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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:14:11+00:00 2026-06-06T03:14:11+00:00

I am having PHP class class SurveyQuestion extends CActiveRecord { public function relations() {

  • 0

I am having PHP class

class SurveyQuestion extends CActiveRecord
{
    public function relations()
    {
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
    return array(
        'surveyOptions' => array(self::HAS_MANY, 'SurveyOptions', 'surveyQuestion_id'),
        'survey' => array(self::BELONGS_TO, 'Survey', 'survey_id'),
         );
    }
}

and in controller, I want to get list of surveys with its options, so I am doing..

$this->renderJson(array('success'=>true, 'message'=>'Records Retrieved Successfully',
'data'=>SurveyQuestion::model()->with('surveyOptions')->findAll()));

but when this controller method is getting called, I am getting this error..

include(SurveyOptions.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

As per http://www.yiiframework.com/doc/guide/1.1/en/database.arr, I should be able to get response with options in each survey.

I think, inclue(SurveyOptions.php) should be SurveyOption.php (without ‘s’) but
I am not able to see what is wrong?

  • 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-06T03:14:12+00:00Added an answer on June 6, 2026 at 3:14 am

    After reading your comments, you just need to change your relation :

    'surveyOptions' => array(self::HAS_MANY, 'SurveyOption', 'surveyQuestion_id')
    

    Since your class name is SurveyOption and file is SurveyOption.php

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

Sidebar

Related Questions

I'm having this problem with this piece of PHP code: class Core { public
Please consider the following code: <?php class MyException extends Exception {} function global_exception_handler($exception) {
See the following example (PHP) class Parent { protected $_property; protected $_anotherP; public function
I am having one problem with the PHP json_encode function. It encodes numbers as
I have the following code: <?php class Human() { function __construct() { echo A
Basically this is what i want to do: <?php class App { public $var
Looking for a PHP class to generate HUGE xlsx files, without having to allocate
I'm trying to translate a PHP class into JavaScript. The only thing I'm having
I am having a small problem with my PHP MySQL Select. The function is
I'm having a bit of trouble defining a property in a PHP class I'm

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.