Skip to content

Commit e95c9e6

Browse files
authored
Updated readme and added alias for Manager (#80)
1 parent 03f8cd8 commit e95c9e6

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

README.md

+33-14
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,13 @@ If you are not using Symfony Flex, you need to enable the bundle by adding it to
4040
the list of registered bundles in the `app/AppKernel.php` file of your project.
4141

4242
```php
43-
// app/AppKernel.php
44-
45-
class AppKernel extends Kernel
46-
{
47-
public function registerBundles()
48-
{
49-
$bundles = array(
50-
// ...
51-
new BM\BackupManagerBundle\BMBackupManagerBundle(),
52-
);
53-
}
54-
}
43+
// config/bundles.php
44+
45+
return [
46+
BM\BackupManagerBundle\BMBackupManagerBundle::class => ['all' => true],
47+
// ...
48+
];
49+
5550
```
5651

5752
Step 3: Configure your databases and filesystems
@@ -142,9 +137,21 @@ To backup from any configured database.
142137
Backup the development database to `Amazon S3`. The S3 backup path will be `test/backup.sql.gz` in the end, when `gzip` is done with it.
143138

144139
```php
145-
$this->container->get('backup_manager')->makeBackup()->run('development', [new Destination('s3', 'test/backup.sql')], 'gzip');
140+
class Foo {
141+
private $backupManager;
142+
143+
public function __construct(BackupManager $backupManager) {
144+
$this->backupManager = $backupManager;
145+
}
146+
147+
public function bar() {
148+
$this->backupManager->makeBackup()->run('development', [new Destination('s3', 'test/backup.sql')], 'gzip');
149+
}
150+
}
146151
```
147152

153+
Or with a command:
154+
148155
```bash
149156
php bin/console backup-manager:backup development s3 -c gzip --filename test/backup.sql
150157
```
@@ -155,9 +162,21 @@ To restore from any configured filesystem.
155162
Restore the database file `test/backup.sql.gz` from `Amazon S3` to the `development` database.
156163

157164
```php
158-
$this->container->get('backup_manager')->makeRestore()->run('s3', 'test/backup.sql.gz', 'development', 'gzip');
165+
class Foo {
166+
private $backupManager;
167+
168+
public function __construct(BackupManager $backupManager) {
169+
$this->backupManager = $backupManager;
170+
}
171+
172+
public function bar() {
173+
$this->backupManager->makeRestore()->run('s3', 'test/backup.sql.gz', 'development', 'gzip');
174+
}
175+
}
159176
```
160177

178+
Or with a command:
179+
161180
```bash
162181
php bin/console backup-manager:restore development s3 test/backup.sql.gz -c gzip
163182
```

Resources/config/services.yml

+3
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ services:
102102
backup_manager:
103103
class: BackupManager\Manager
104104
arguments: ["@backup_manager.filesystems", "@backup_manager.databases", "@backup_manager.compressors"]
105+
106+
# Add alias for autowriring
107+
BackupManager\Manager: '@backup_manager'

0 commit comments

Comments
 (0)