StatisticsListener   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 19
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A postGenerateSchema() 0 16 2
1
<?php
2
3
namespace JMS\JobQueueBundle\Entity\Listener;
4
5
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
6
7
class StatisticsListener
8
{
9 52
    public function postGenerateSchema(GenerateSchemaEventArgs $event)
10
    {
11 52
        $schema = $event->getSchema();
12
13
        // When using multiple entity managers ignore events that are triggered by other entity managers.
14 52
        if ($event->getEntityManager()->getMetadataFactory()->isTransient('JMS\JobQueueBundle\Entity\Job')) {
15 22
            return;
16
        }
17
18 52
        $table = $schema->createTable('jms_job_statistics');
19 52
        $table->addColumn('job_id', 'bigint', array('notnull' => true, 'unsigned' => true));
20 52
        $table->addColumn('characteristic', 'string', array('length' => 30, 'notnull' => true));
21 52
        $table->addColumn('createdAt', 'datetime', array('notnull' => true));
22 52
        $table->addColumn('charValue', 'float', array('notnull' => true));
23 52
        $table->setPrimaryKey(array('job_id', 'characteristic', 'createdAt'));
24
    }
25
}