Issues (3627)

app/bundles/LeadBundle/Entity/CompanyLead.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\LeadBundle\Entity;
13
14
use Doctrine\ORM\Mapping as ORM;
15
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
16
17
class CompanyLead
18
{
19
    /**
20
     * @var Company
21
     **/
22
    private $company;
23
24
    /**
25
     * @var Lead
26
     */
27
    private $lead;
28
29
    /**
30
     * @var \DateTime
31
     */
32
    private $dateAdded;
33
34
    /**
35
     * @var bool
36
     */
37
    private $primary = false;
38
39
    public static function loadMetadata(ORM\ClassMetadata $metadata)
40
    {
41
        $builder = new ClassMetadataBuilder($metadata);
42
43
        $builder->setTable('companies_leads')
44
            ->setCustomRepositoryClass(CompanyLeadRepository::class);
45
46
        $builder->createManyToOne('company', 'Company')
47
            ->isPrimaryKey()
48
            ->addJoinColumn('company_id', 'id', false, false, 'CASCADE')
49
            ->build();
50
51
        $builder->addLead(false, 'CASCADE', true);
0 ignored issues
show
Deprecated Code introduced by
The function Mautic\CoreBundle\Doctri...adataBuilder::addLead() has been deprecated: Use addContact instead; existing implementations will need a migration to rename lead_id to contact_id ( Ignorable by Annotation )

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

51
        /** @scrutinizer ignore-deprecated */ $builder->addLead(false, 'CASCADE', true);

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

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

Loading history...
52
53
        $builder->addDateAdded();
54
55
        $builder->createField('primary', 'boolean')
56
            ->columnName('is_primary')
57
            ->nullable()
58
            ->build();
59
    }
60
61
    /**
62
     * @return \DateTime
63
     */
64
    public function getDateAdded()
65
    {
66
        return $this->dateAdded;
67
    }
68
69
    /**
70
     * @param \DateTime $date
71
     */
72
    public function setDateAdded($date)
73
    {
74
        $this->dateAdded = $date;
75
    }
76
77
    /**
78
     * @return mixed
79
     */
80
    public function getLead()
81
    {
82
        return $this->lead;
83
    }
84
85
    /**
86
     * @param mixed $lead
87
     */
88
    public function setLead($lead)
89
    {
90
        $this->lead = $lead;
91
    }
92
93
    /**
94
     * @return Company
95
     */
96
    public function getCompany()
97
    {
98
        return $this->company;
99
    }
100
101
    /**
102
     * @return Company
103
     */
104
    public function getCompanies()
105
    {
106
        return $this->company;
107
    }
108
109
    /**
110
     * @param Company $company
111
     */
112
    public function setCompany($company)
113
    {
114
        $this->company = $company;
115
    }
116
117
    /**
118
     * @param bool $primary
119
     */
120
    public function setPrimary($primary)
121
    {
122
        $this->primary = $primary;
123
    }
124
125
    /**
126
     * @return bool
127
     */
128
    public function getPrimary()
129
    {
130
        return $this->primary;
131
    }
132
}
133