-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
CLI Tools | ||
========= | ||
|
||
Doctrine DBAL bundles commands that can be integrated into a Symfony console application. | ||
|
||
When you use DBAL inside a full-stack Symfony application, DoctrineBundle already integrates those into your | ||
application's console. | ||
|
||
There is also a standalone console runner available. To use it, make sure that Symfony console is installed:: | ||
|
||
composer require symfony/console | ||
|
||
With a small PHP script, you can bootstrap the console tools: | ||
|
||
.. code-block:: php | ||
#!/usr/bin/env php | ||
<?php | ||
use Doctrine\DBAL\DriverManager; | ||
use Doctrine\DBAL\Tools\Console\ConnectionProvider\SingleConnectionProvider; | ||
use Doctrine\DBAL\Tools\Console\ConsoleRunner; | ||
// The path to Composer's autoloader | ||
// Adjust it according to your project's structure | ||
require __DIR__ . '/vendor/autoload.php'; | ||
$connection = DriverManager::getConnection([ | ||
// Configure your DBAL connection here. | ||
]); | ||
ConsoleRunner::run( | ||
new SingleConnectionProvider($connection) | ||
); | ||
If your application uses more than one connection, write your own implementation of ``ConnectionProvider`` and use it | ||
instead of the ``SingleConnectionProvider`` class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters