Conditions | 4 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Nord\Lumen\Doctrine\ORM\Console; |
||
20 | public function fire() |
||
21 | { |
||
22 | $metadata = $this->getEntityManager()->getMetadataFactory()->getAllMetadata(); |
||
23 | |||
24 | if (empty($metadata)) { |
||
25 | $this->error('No metadata found.'); |
||
26 | exit; |
||
|
|||
27 | } |
||
28 | |||
29 | $directory = array_get($this->laravel['config'], 'doctrine.proxy.directory'); |
||
30 | |||
31 | if (! $directory) { |
||
32 | $this->error('Proxy directory must be set.'); |
||
33 | exit; |
||
34 | } |
||
35 | |||
36 | $this->info('Generating proxies ...'); |
||
37 | |||
38 | foreach ($metadata as $item) { |
||
39 | $this->line($item->name); |
||
40 | } |
||
41 | |||
42 | $this->getEntityManager()->getProxyFactory()->generateProxyClasses($metadata, $directory); |
||
43 | |||
44 | $this->info('Proxies created!'); |
||
45 | } |
||
46 | } |
||
47 |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.