public static function validateSubject($subject, $throwException = true)
	{
		if (!ComponentConfig::isActiveRecord($subject, $throwException)) return false;
		if (!ComponentConfig::hasBehavior($subject, CommentsBehavior::className(), $throwException)) return false;

		if (empty($subject->primaryKey) || (is_array($subject->primaryKey) && count($subject->primaryKey) === 0)) {
			if (!$throwException) return false;
			$msg = Yii::t('app', 'The model needs a valid primary key');
			throw new InvalidParamException($msg);
		}

		if ($subject->isNewRecord) {
			if (!$throwException) return false;
			$msg = Yii::t('app', 'Commenting is not possible on unsaved models');
			throw new InvalidParamException($msg);
		}

		return true;
	}
public static function validateSubject($subject, $throwException = true)
	{
		if (!ComponentConfig::isActiveRecord($subject, $throwException)) return false;
		if (!ComponentConfig::hasBehavior($subject, CommentsBehavior::className(), $throwException)) return false;

		if (empty($subject->primaryKey) || (is_array($subject->primaryKey) && count($subject->primaryKey) === 0)) {
			if (!$throwException) return false;
			$msg = Yii::t('app', 'The model needs a valid primary key');
			throw new InvalidParamException($msg);
		}

		if ($subject->isNewRecord) {
			if (!$throwException) return false;
			$msg = Yii::t('app', 'Commenting is not possible on unsaved models');
			throw new InvalidParamException($msg);
		}

		return true;
	}
public static function validateSubject ( $ subject , $ throwException = true ) { if ( ! ComponentConfig :: isActiveRecord ( $ subject , $ throwException ) ) return false ; if ( ! ComponentConfig :: hasBehavior ( $ subject , CommentsBehavior :: className ( ) , $ throwException ) ) return false ; if ( empty ( $ subject -> primaryKey ) || ( is_array ( $ subject -> primaryKey ) && count ( $ subject -> primaryKey ) === 0 ) ) { if ( ! $ throwException ) return false ; $ msg = Yii :: t ( 'app' , 'The model needs a valid primary key' ) ; throw new InvalidParamException ( $ msg ) ; } if ( $ subject -> isNewRecord ) { if ( ! $ throwException ) return false ; $ msg = Yii :: t ( 'app' , 'Commenting is not possible on unsaved models' ) ; throw new InvalidParamException ( $ msg ) ; } return true ; }
Validates if the model is an active record, has the comments behavior, has a primary key and is not a new record.

@param \yii\db\ActiveRecord $subject the subject model
@param bool $throwException
@return bool false means this subject is invalid
@throws \yii\base\InvalidConfigException|\yii\base\InvalidParamException
Validates if the model is an active record has the comments behavior has a primary key and is not a new record .