Completed
Push — master ( 63d470...84e35a )
by Adam
18:27
created

ShopMappingEnhancer::configureMappingDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 1
1
<?php
2
/*
3
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\InvoiceBundle\Enhancer;
14
15
use WellCommerce\Bundle\AppBundle\Entity\Shop;
16
use WellCommerce\Component\DoctrineEnhancer\AbstractMappingEnhancer;
17
use WellCommerce\Component\DoctrineEnhancer\Definition\FieldDefinition;
18
use WellCommerce\Component\DoctrineEnhancer\Definition\MappingDefinitionCollection;
19
use WellCommerce\Extra\AppBundle\Entity\ShopExtraTrait;
20
21
/**
22
 * Class ShopMappingEnhancer
23
 *
24
 * @author  Adam Piotrowski <[email protected]>
25
 */
26
final class ShopMappingEnhancer extends AbstractMappingEnhancer
27
{
28
    protected function configureMappingDefinition(MappingDefinitionCollection $collection)
29
    {
30
        $collection->add(new FieldDefinition([
31
            'fieldName'  => 'invoiceMaturity',
32
            'type'       => 'integer',
33
            'unique'     => false,
34
            'nullable'   => false,
35
            'columnName' => 'invoice_maturity',
36
            'options'    => [
37
                'default' => 7,
38
            ],
39
        ]));
40
        
41
        $collection->add(new FieldDefinition([
42
            'fieldName'  => 'invoiceProcessor',
43
            'type'       => 'string',
44
            'nullable'   => false,
45
            'columnName' => 'invoice_processor',
46
            'options'    => [
47
                'default' => 'invoice.processor.generic',
48
            ],
49
        ]));
50
    }
51
    
52
    public function getSupportedEntityClass(): string
53
    {
54
        return Shop::class;
55
    }
56
    
57
    public function getExtraTraitClass(): string
58
    {
59
        return ShopExtraTrait::class;
60
    }
61
}
62