|
Revision 13851, 1.6 kB
(checked in by Jonathan.Wage, 4 years ago)
|
[1.2] sfDoctrinePlugin: fixes issue with Doctrine cli messages not being forwarded to symfony cli (fixes #5181)
|
- Property svn:keywords set to
Id Date Author Revision HeadURL
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
class sfDoctrineCli extends Doctrine_Cli |
|---|
| 22 |
{ |
|---|
| 23 |
protected $dispatcher, |
|---|
| 24 |
$formatter; |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
* Set the dispatcher of the cli instance |
|---|
| 28 |
* |
|---|
| 29 |
* @param object $dispatcher |
|---|
| 30 |
* @return void |
|---|
| 31 |
*/ |
|---|
| 32 |
public function setDispatcher($dispatcher) |
|---|
| 33 |
{ |
|---|
| 34 |
$this->dispatcher = $dispatcher; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
* Set the formatter to use for the cli |
|---|
| 39 |
* |
|---|
| 40 |
* @param object $formatter |
|---|
| 41 |
* @return void |
|---|
| 42 |
*/ |
|---|
| 43 |
public function setFormatter($formatter) |
|---|
| 44 |
{ |
|---|
| 45 |
$this->formatter = $formatter; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
* Notify the dispatcher of a message. We silent the messages from the Doctrine cli. |
|---|
| 50 |
* |
|---|
| 51 |
* @param string $notification |
|---|
| 52 |
* @param string $style |
|---|
| 53 |
* @return false |
|---|
| 54 |
*/ |
|---|
| 55 |
public function notify($notification = null, $style = 'HEADER') |
|---|
| 56 |
{ |
|---|
| 57 |
$this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('doctrine', $notification)))); |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
* Notify symfony of an exception thrown by the Doctrine cli |
|---|
| 62 |
* |
|---|
| 63 |
* @param Doctrine_Exception $exception |
|---|
| 64 |
* @return void |
|---|
| 65 |
* @throws sfException |
|---|
| 66 |
*/ |
|---|
| 67 |
public function notifyException($exception) |
|---|
| 68 |
{ |
|---|
| 69 |
throw new sfException($exception->getMessage()); |
|---|
| 70 |
} |
|---|
| 71 |
} |
|---|