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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:49:41+00:00 2026-06-15T23:49:41+00:00

Currently I am working in YII framework, Where I created a class that extends

  • 0

Currently I am working in YII framework, Where I created a class that extends CFormModel,

In that class I override the following functions:

public function __get($name)
public function __set($name, $value)

I have put the following checks in to make sure end_date and start_date aren’t null

if(!empty($this->end_date) AND !empty($this->start_date))
{
      **/*Not Working*/**
      /*Some Application Logic*/
}

But it’s not working properly and the condition is not getting satisfied. When I debug the code I came to know that $this->start_date and $this->end_date is not empty. Afterwards I changed the checks to the following:

if($this->end_date!='' AND $this->start_date!='')
{
      **/*Working*/**
      /*Some Application Logic*/
}

It’s working as expected, but still I don’t get why the empty function is not working properly.
Is it because of magic method OR is there any reason for this issue?

  • 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-15T23:49:42+00:00Added an answer on June 15, 2026 at 11:49 pm

    You have to define a magic __isset() method for this to work.

    public function __isset($name) {
        return isset($this->data[$name]);
    }
    

    This will be triggered calls to isset() or empty() for inaccessible properties.

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

Sidebar

Related Questions

I'm working on PHP & Yii framework. Currently I found that filtering my data
I am working in Yii. I have following function in controller- public function actiongetDnySubjectLink()
Im currently working on a project that requires the following. I need to be
Currently working with converting SQLException error messages into messages that are more useful for
Currently working with the following package structure: /package __init__.py final.py /write __init__.py write.py /data
Im currently working on a game that uses multi touch to apply zoom to
Am currently working on an application that requires users to submit posts and comments
I am currently working with a db that utilizes a subtype / supertype structure.
Am currently working on a site that uses a lot of cfwindow objects and
I am currently working on adding pre-validation to my website. So that pages that

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.