Commit 7d26fa30 authored by webchick's avatar webchick
Browse files

Issue #1854838 by Jose Reyero, Gábor Hojtsy, Damien Tournoud: Fixed Locale...

Issue #1854838 by Jose Reyero, Gábor Hojtsy, Damien Tournoud: Fixed Locale should not use fetchObject with a classname, WSOD on sqlite.
parent 5058fa38
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use PDO;
/** /**
* Defines the locale string class. * Defines the locale string class.
...@@ -63,27 +62,31 @@ public function getTranslations(array $conditions = array(), array $options = ar ...@@ -63,27 +62,31 @@ public function getTranslations(array $conditions = array(), array $options = ar
* Implements Drupal\locale\StringStorageInterface::findString(). * Implements Drupal\locale\StringStorageInterface::findString().
*/ */
public function findString(array $conditions) { public function findString(array $conditions) {
$string = $this->dbStringSelect($conditions) $values = $this->dbStringSelect($conditions)
->execute() ->execute()
->fetchObject('Drupal\locale\SourceString'); ->fetchAssoc();
if ($string) {
if (!empty($values)) {
$string = new SourceString($values);
$string->setStorage($this); $string->setStorage($this);
return $string;
} }
return $string;
} }
/** /**
* Implements Drupal\locale\StringStorageInterface::findTranslation(). * Implements Drupal\locale\StringStorageInterface::findTranslation().
*/ */
public function findTranslation(array $conditions) { public function findTranslation(array $conditions) {
$string = $this->dbStringSelect($conditions, array('translation' => TRUE)) $values = $this->dbStringSelect($conditions, array('translation' => TRUE))
->execute() ->execute()
->fetchObject('Drupal\locale\TranslationString'); ->fetchAssoc();
if ($string) {
if (!empty($values)) {
$string = new TranslationString($values);
$this->checkVersion($string, VERSION); $this->checkVersion($string, VERSION);
$string->setStorage($this); $string->setStorage($this);
return $string;
} }
return $string;
} }
/** /**
...@@ -359,11 +362,12 @@ protected function dbStringDefaults($string, $table = NULL) { ...@@ -359,11 +362,12 @@ protected function dbStringDefaults($string, $table = NULL) {
* Array of objects of the class requested. * Array of objects of the class requested.
*/ */
protected function dbStringLoad(array $conditions, array $options, $class) { protected function dbStringLoad(array $conditions, array $options, $class) {
$strings = array();
$result = $this->dbStringSelect($conditions, $options)->execute(); $result = $this->dbStringSelect($conditions, $options)->execute();
$result->setFetchMode(PDO::FETCH_CLASS, $class); foreach ($result as $item) {
$strings = $result->fetchAll(); $string = new $class($item);
foreach ($strings as $string) {
$string->setStorage($this); $string->setStorage($this);
$strings[] = $string;
} }
return $strings; return $strings;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment