Issues (3627)

app/bundles/ReportBundle/Entity/Scheduler.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2014 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\ReportBundle\Entity;
13
14
use Doctrine\DBAL\Types\Type;
15
use Doctrine\ORM\Mapping as ORM;
16
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
17
18
/**
19
 * Class Scheduler.
20
 */
21
class Scheduler
22
{
23
    /**
24
     * @var int
25
     */
26
    private $id;
27
28
    /**
29
     * @var Report
30
     */
31
    private $report;
32
33
    /**
34
     * @var \DateTimeInterface
35
     */
36
    private $scheduleDate;
37
38
    public static function loadMetadata(ORM\ClassMetadata $metadata)
39
    {
40
        $builder = new ClassMetadataBuilder($metadata);
41
42
        $builder->setTable('reports_schedulers')
43
            ->setCustomRepositoryClass(SchedulerRepository::class);
44
45
        $builder->addId();
46
47
        $builder->createManyToOne('report', Report::class)
48
            ->addJoinColumn('report_id', 'id', false, false, 'CASCADE')
49
            ->build();
50
51
        $builder->createField('scheduleDate', Type::DATETIME)
0 ignored issues
show
Deprecated Code introduced by
The constant Doctrine\DBAL\Types\Type::DATETIME has been deprecated: Use {@see Types::DATETIME_MUTABLE} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

51
        $builder->createField('scheduleDate', /** @scrutinizer ignore-deprecated */ Type::DATETIME)

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
52
            ->columnName('schedule_date')
53
            ->nullable(false)
54
            ->build();
55
    }
56
57
    public function __construct(Report $report, \DateTimeInterface $scheduleDate)
58
    {
59
        $this->report       = $report;
60
        $this->scheduleDate = $scheduleDate;
61
    }
62
63
    /**
64
     * Get id.
65
     *
66
     * @return int
67
     */
68
    public function getId()
69
    {
70
        return $this->id;
71
    }
72
73
    /**
74
     * @return Report
75
     */
76
    public function getReport()
77
    {
78
        return $this->report;
79
    }
80
81
    /**
82
     * @return \DateTimeInterface
83
     */
84
    public function getScheduleDate()
85
    {
86
        return $this->scheduleDate;
87
    }
88
}
89