defer to Tim's wisdom
authorEileen McNaughton <eileen@fuzion.co.nz>
Wed, 7 Jan 2015 03:21:41 +0000 (16:21 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Wed, 7 Jan 2015 03:21:41 +0000 (16:21 +1300)
CRM/Core/Payment.php
Civi/Payment/System.php

index 273dbbfdcd6372b8dbd766911518293f9fc97f5f..ee9e77810abf981090d2c5ed303fb67ef4fdcf5e 100644 (file)
@@ -110,7 +110,10 @@ abstract class CRM_Core_Payment {
     if (empty($paymentProcessor)) {
       return CRM_Core_DAO::$_nullObject;
     }
-    Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
+    //we use two lines because we can't remove the '&singleton' without risking breakage
+    //of extension classes that extend this one
+    $object =  Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
+    return $object;
   }
 
   /**
index 59e5eb1a94fe1e9f4871da75cdfddd17c5d06541..18d66651ca582174fe28f60c7aa2212ebacfb846 100644 (file)
@@ -16,7 +16,7 @@ class System {
   /**
    * @var array cache
    */
-  private static $cache = array();
+  private $cache = array();
 
   /**
    * @return \Civi\Payment\System
@@ -35,8 +35,8 @@ class System {
   public function getByProcessor($processor) {
     $id = $processor['id'];
 
-    if (!isset(self::$cache[$id])) {
-      if (!isset(self::$cache[$id])) {
+    if (!isset($this->cache[$id])) {
+      if (!isset($this->cache[$id])) {
         //does this config need to be called?
         $config = \CRM_Core_Config::singleton();
         $ext = \CRM_Extension_System::singleton()->getMapper();
@@ -52,10 +52,10 @@ class System {
           require_once str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php';
         }
 
-        self::$cache[$id] = new $paymentClass($processor['is_test'] ? 'test' : 'live', $processor);
+        $this->cache[$id] = new $paymentClass($processor['is_test'] ? 'test' : 'live', $processor);
       }
     }
-    return self::$cache[$id];
+    return $this->cache[$id];
   }
   /**
    * @param integer $id