Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
313cf151
Commit
313cf151
authored
Jul 01, 2014
by
quot;brussens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Russian translate concept-service-locator.md
Added Russian translate docs\guide-ru\concept-service-locator.md
parent
94b88fcb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
concept-service-locator.md
docs/guide-ru/concept-service-locator.md
+5
-5
No files found.
docs/guide-ru/concept-service-locator.md
View file @
313cf151
...
...
@@ -24,10 +24,10 @@ use yii\caching\FileCache;
$locator
=
new
ServiceLocator
;
//
register "cache" using a class name that can be used to create a component
//
Зарегистрирует "cache", используя имя класса, которое может быть использовано для создания компонента.
$locator
->
set
(
'cache'
,
'yii\caching\ApcCache'
);
//
register "db" using a configuration array that can be used to create a component
//
Зарегистрирует "db", используя конфигурационный массив, который может быть использован для создания компонента.
$locator
->
set
(
'db'
,
[
'class'
=>
'yii\db\Connection'
,
'dsn'
=>
'mysql:host=localhost;dbname=demo'
,
...
...
@@ -35,12 +35,12 @@ $locator->set('db', [
'password'
=>
''
,
]);
//
register "search" using an anonymous function that builds a component
//
Зарегистрирует "search", используя анонимную функцию, которая создаёт компонент
$locator
->
set
(
'search'
,
function
()
{
return
new
app\components\SolrService
;
});
//
register "pageCache" using a component
//
Зарегистрирует "pageCache", используя компонент
$locator
->
set
(
'pageCache'
,
new
FileCache
);
```
...
...
@@ -49,7 +49,7 @@ $locator->set('pageCache', new FileCache);
```
php
$cache
=
$locator
->
get
(
'cache'
);
//
or alternatively
//
или альтернативный
$cache
=
$locator
->
cache
;
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment