yii2-relation-trait icon indicating copy to clipboard operation
yii2-relation-trait copied to clipboard

check softdelete and softrestore via hasProperty method

Open masiorama opened this issue 6 years ago • 1 comments

The usage of isset() raises a warning while using hasProperty() does not. Hope il helps.

masiorama avatar May 30 '19 09:05 masiorama

This doesn't behave as expected. It's not evaluating the same way as isset does. Haven't had a chance to check it out further, other than the differences described in it's phpdoc. I first thought it was because _rt_softdelete and restore are declared private, but can't be that. Here's the docs

/** * Returns a value indicating whether a property is defined for this component. * * A property is defined if: * * - the class has a getter or setter method associated with the specified name * (in this case, property name is case-insensitive); * - the class has a member variable with the specified name (when $checkVars is true); * - an attached behavior has a property of the given name (when $checkBehaviors is true).

I just implemented this pull request and it stopped evaluating as true

drew1two avatar Jun 16 '21 06:06 drew1two