1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand; |
6
|
|
|
use Doctrine\ORM\Tools\Export\Driver\AbstractExporter; |
7
|
|
|
use Doctrine\ORM\Tools\Export\Driver\XmlExporter; |
8
|
|
|
use Doctrine\ORM\Tools\Export\Driver\YamlExporter; |
9
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
10
|
|
|
use Symfony\Component\Console\Input\InputOption; |
11
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Convert Doctrine ORM metadata mapping information between the various supported |
15
|
|
|
* formats. |
16
|
|
|
*/ |
17
|
|
|
class ConvertMappingDoctrineCommand extends ConvertMappingCommand |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* {@inheritDoc} |
21
|
|
|
*/ |
22
|
|
|
protected function configure() |
23
|
|
|
{ |
24
|
|
|
parent::configure(); |
25
|
|
|
$this |
26
|
|
|
->setName('doctrine:mapping:convert') |
27
|
|
|
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* {@inheritDoc} |
32
|
|
|
*/ |
33
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
34
|
|
|
{ |
35
|
|
|
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); |
|
|
|
|
36
|
|
|
|
37
|
|
|
return parent::execute($input, $output); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param string $toType |
42
|
|
|
* @param string $destPath |
43
|
|
|
* |
44
|
|
|
* @return AbstractExporter |
45
|
|
|
*/ |
46
|
|
|
protected function getExporter($toType, $destPath) |
47
|
|
|
{ |
48
|
|
|
/** @var AbstractExporter $exporter */ |
49
|
|
|
$exporter = parent::getExporter($toType, $destPath); |
50
|
|
|
if ($exporter instanceof XmlExporter) { |
51
|
|
|
$exporter->setExtension('.orm.xml'); |
52
|
|
|
} elseif ($exporter instanceof YamlExporter) { |
53
|
|
|
$exporter->setExtension('.orm.yml'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
return $exporter; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: