Used more DatabaseWrapperFactory as one instance of each is fine.
[core.git] / inc / classes / main / discovery / payment / class_LocalPaymentDiscovery.php
index 175756ea2cd39e13d573d8eea50e9fefd05c137e..9785bef4e5eb9b99d79e78c447e3713f42872e4c 100644 (file)
@@ -4,11 +4,11 @@
  * registered payment types and like all the others it at least returns the
  * money bank transfer type.
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,10 +32,6 @@ class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Regis
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
@@ -44,7 +40,7 @@ class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Regis
         * @param       $filterInstance         An instance of a filter
         * @return      $discoveryInstance      An instance of this discovery class
         */
-       public final static function createLocalPaymentDiscovery (Filterable $filterInstance) {
+       public static final function createLocalPaymentDiscovery (Filterable $filterInstance) {
                // Get an instance of this class
                $discoveryInstance = new LocalPaymentDiscovery();
 
@@ -69,11 +65,14 @@ class LocalPaymentDiscovery extends BaseDiscovery implements Discoverable, Regis
                $criteriaInstance->setLimit(1);
 
                // Get a wrapper instance
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('payment_db_wrapper_class');
+               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('payment_db_wrapper_class');
 
                // Get result back
                $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
 
+               // Advanced to next entry and assert on it as it should always be there
+               assert($resultInstance->valid());
+
                // Set the result instance
                $this->setResultInstance($resultInstance);
        }