Development

/branches/1.2/lib/plugins/sfDoctrinePlugin/lib/cli/sfDoctrineCli.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/plugins/sfDoctrinePlugin/lib/cli/sfDoctrineCli.class.php

Revision 13851, 1.6 kB (checked in by Jonathan.Wage, 6 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  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  * (c) Jonathan H. Wage <jonwage@gmail.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 /**
13  * sfDoctrineCli
14  *
15  * @package    symfony
16  * @subpackage doctrine
17  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
18  * @author     Jonathan H. Wage <jonwage@gmail.com>
19  * @version    SVN: $Id$
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 }
Note: See TracBrowser for help on using the browser.