StringDatabaseStorage
class StringDatabaseStorage implements StringStorageInterface (View source)
Defines a class to store localized strings in the database.
Properties
| protected Connection | $connection | The database connection. |
|
| protected array | $options | Additional database connection options to use in queries. |
Methods
Constructs a new StringDatabaseStorage class.
Loads multiple source string objects.
Loads multiple string translation objects.
Loads a string source object, fast query.
Loads a string translation object, fast query.
Loads string location information.
Counts source strings.
Counts translations.
Checks whether the string version matches a given version, fix it if not.
Deletes source strings and translations using conditions.
Deletes translations using conditions.
Creates a source string object bound to this storage but not saved.
Creates a string translation object bound to this storage but not saved.
Gets table alias for field.
Loads multiple string objects.
Builds a SELECT query with multiple conditions and fields.
Executes an arbitrary SELECT query string with the injected options.
Details
__construct(Connection $connection, array $options = [])
Constructs a new StringDatabaseStorage class.
array
getStrings(array $conditions = [], array $options = [])
Loads multiple source string objects.
StringInterface[]
getTranslations(array $conditions = [], array $options = [])
Loads multiple string translation objects.
SourceString|null
findString(array $conditions)
Loads a string source object, fast query.
These 'fast query' methods are the ones in the critical path and their implementation must be optimized for speed, as they may run many times in a single page request.
TranslationString|null
findTranslation(array $conditions)
Loads a string translation object, fast query.
This function must only be used when actually translating strings as it will have the effect of updating the string version. For other purposes the getTranslations() method should be used instead.
StringInterface[]
getLocations(array $conditions = [])
Loads string location information.
int
countStrings()
Counts source strings.
array
countTranslations()
Counts translations.
$this
save(StringInterface $string)
Save string object to storage.
protected
updateLocation(StringInterface $string)
Update locations for string.
protected
checkVersion(StringInterface $string, string $version)
Checks whether the string version matches a given version, fix it if not.
$this
delete(StringInterface $string)
Delete string from storage.
deleteStrings(array $conditions)
Deletes source strings and translations using conditions.
deleteTranslations(array $conditions)
Deletes translations using conditions.
SourceString
createString(array $values = [])
Creates a source string object bound to this storage but not saved.
TranslationString
createTranslation(array $values = [])
Creates a string translation object bound to this storage but not saved.
protected string
dbFieldTable(string $field)
Gets table alias for field.
protected string
dbStringTable(StringInterface $string)
Gets table name for storing string object.
protected array
dbStringKeys(StringInterface $string)
Gets keys values that are in a database table.
protected StringInterface[]
dbStringLoad(array $conditions, array $options, string $class)
Loads multiple string objects.
protected Select
dbStringSelect(array $conditions, array $options = [])
Builds a SELECT query with multiple conditions and fields.
The query uses both 'locales_source' and 'locales_target' tables. Note that by default, as we are selecting both translated and untranslated strings target field's conditions will be modified to match NULL rows too.
protected bool|int
dbStringInsert(StringInterface $string)
Creates a database record for a string object.
protected bool|int
dbStringUpdate(StringInterface $string)
Updates string object in the database.
protected Delete
dbDelete(string $table, array $keys)
Creates delete query.
protected
dbExecute($query, array $args = [])
Executes an arbitrary SELECT query string with the injected options.