I am using CiviCRM 4.7.22 with Drupal 7 on Windows. I have a basic question. In the `formRule()` function inside the `MembershipRenewal.php` containing Membership Renewal Form if I use $this as below

```
$this->assign('endDate', CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'end_date')));

```

I get a PHP error:

```
PHP Fatal error: Using $this when not in object context in ...\MembershipRenewal.php on line xxx

```

Although this code works in `preProcess()` and `buildQuickForm()` without any issues. If its part of the same class then why the issue.

What is the alternative for me get the value of `end_date` or `join_date` in `formRule()` to perform some validition. In general, how do I get any value which is NOT part of a form in `formRule()`.