mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 20:36:15 +02:00
Fix for start up bug. Re factoring singleton code had brroken due to scope of clas var.
This commit is contained in:
parent
a0e0870f1a
commit
027b614050
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// This is executed inside DatabaseMigrationService class/context
|
||||
|
||||
$db = $this->DatabaseService->GetDbConnection();
|
||||
$db = $this->getDatabaseService()->GetDbConnection();
|
||||
|
||||
if (defined('GROCY_HTTP_USER'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
// This is executed inside DatabaseMigrationService class/context
|
||||
|
||||
use \Grocy\Services\LocalizationService;
|
||||
$localizationService = new LocalizationService(GROCY_CULTURE);
|
||||
$localizationService = $this->getLocalizationService();
|
||||
|
||||
$db = $this->DatabaseService->GetDbConnection();
|
||||
$db = $this->getDatabaseService()->GetDbConnection();
|
||||
|
||||
if ($db->quantity_units()->count() === 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
// This is executed inside DatabaseMigrationService class/context
|
||||
|
||||
use \Grocy\Services\LocalizationService;
|
||||
$localizationService = new LocalizationService(GROCY_CULTURE);
|
||||
$localizationService = $this->getLocalizationService();
|
||||
|
||||
$db = $this->DatabaseService->GetDbConnection();
|
||||
$db = $this->getDatabaseService()->GetDbConnection();
|
||||
|
||||
$defaultShoppingList = $this->Database->shopping_lists()->where('id = 1')->fetch();
|
||||
$defaultShoppingList = $db->shopping_lists()->where('id = 1')->fetch();
|
||||
$defaultShoppingList->update(array(
|
||||
'name' => $localizationService->__t('Shopping list')
|
||||
));
|
||||
|
|
|
|||
|
|
@ -10,16 +10,17 @@ class BaseService
|
|||
public function __construct() {
|
||||
}
|
||||
|
||||
private static $instance = null;
|
||||
private static $instances = array();
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
if (self::$instance == null)
|
||||
$className = get_called_class();
|
||||
if(!isset(self::$instances[$className]))
|
||||
{
|
||||
self::$instance = new self();
|
||||
self::$instances[$className] = new $className();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
return self::$instances[$className];
|
||||
}
|
||||
|
||||
protected function getDatabaseService()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user