Completed
Push — master ( 55dbed...4e3396 )
by Piotr
12s
created

NewsDataSourceBuilder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 44
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B buildNewsDataSource() 0 41 1
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\FixturesBundle\DataSource;
11
12
use FSi\Component\DataSource\DataSourceInterface;
13
14
class NewsDataSourceBuilder
15
{
16
    public static function buildNewsDataSource(DataSourceInterface $datasource)
17
    {
18
        $datasource->addField('title', 'text', 'like', [
19
            'sortable' => false,
20
            'form_options' => [
21
                'label' => 'admin.news.list.title',
22
            ]
23
        ]);
24
25
        $datasource->addField('created_at', 'date', 'between', [
26
            'field' => 'createdAt',
27
            'sortable' => true,
28
            'form_from_options' => [
29
                'widget' => 'single_text',
30
                'label' => 'admin.news.list.created_at_from',
31
            ],
32
            'form_to_options' => [
33
                'widget' => 'single_text',
34
                'label' => 'admin.news.list.created_at_to',
35
            ]
36
        ]);
37
38
        $datasource->addField('visible', 'boolean', 'eq', [
39
            'sortable' => false,
40
            'form_options' => [
41
                'label' => 'admin.news.list.visible',
42
            ]
43
        ]);
44
45
        $datasource->addField('creator_email', 'text', 'like', [
46
            'field' => 'creatorEmail',
47
            'sortable' => true,
48
            'form_options' => [
49
                'label' => 'admin.news.list.creator_email',
50
            ]
51
        ]);
52
53
        $datasource->setMaxResults(10);
54
55
        return $datasource;
56
    }
57
}
58