<commit_before><?php

declare(strict_types=1);

/*
 * This file is part of SolidInvoice project.
 *
 * (c) 2013-2017 <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace SolidInvoice\ClientBundle\Entity;

use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use SolidInvoice\CoreBundle\Traits\Entity;
use SolidInvoice\InvoiceBundle\Entity\Invoice;
use SolidInvoice\QuoteBundle\Entity\Quote;
use Symfony\Component\Serializer\Annotation as Serialize;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ApiResource(attributes={"normalization_context"={"groups"={"contact_api"}}, "denormalization_context"={"groups"={"contact_api"}}}, collectionOperations={"post"={"method"="POST"}}, iri="https://schema.org/Person")
 * @ORM\Table(name="contacts", indexes={@ORM\Index(columns={"email"})})
 * @ORM\Entity(repositoryClass="SolidInvoice\ClientBundle\Repository\ContactRepository")
 * @Gedmo\Loggable
 */
class Contact implements \Serializable
{
    use Entity\TimeStampable;

    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @Serialize\Groups({"client_api", "contact_api"})
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="firstName", type="string", length=125, nullable=false)
     * @Assert\NotBlank()
     * @Assert\Length(max=125)
     * @Serialize\Groups({"client_api", "contact_api"})
     * @ApiProperty(iri="https://schema.org/givenName")
     */
    private $firstName;

    /**
     * @var string
     *
     * @ORM\Column(name="lastName", type="string", length=125, nullable=true)
     * @Assert\Length(max=125)
     * @Serialize\Groups({"client_api", "contact_api"})
     * @ApiProperty(iri="https://schema.org/familyName")
     */
    private $lastName;

    /**
     * @var Client
     *
     * @ORM\ManyToOne(targetEntity="Client", inversedBy="contacts")
     * @ORM\JoinColumn(name="client_id", referencedColumnName="id")
     * @Serialize\Groups({"contact_api"})
     * @ApiProperty(iri="https://schema.org/Organization")
     * @Assert\Valid()
     * @Assert\NotBlank()
     */
    private $client;

    /**
     * @var string
     *
     * @ORM\Column(name="email", type="string", length=255)
     * @Assert\NotBlank()
     * @Assert\Email(strict=true)
     * @Serialize\Groups({"client_api", "contact_api"})
     * @ApiProperty(iri="https://schema.org/email")
     */
    private $email;

    /**
     * @var Collection|AdditionalContactDetail[]
     *
     * @ORM\OneToMany(targetEntity="AdditionalContactDetail", mappedBy="contact", cascade={"persist", "remove"}, orphanRemoval=true)
     * @Assert\Valid()
     * @Serialize\Groups({"client_api", "contact_api"})
     */
    private $additionalContactDetails;

    /**
     * @var Collection|Invoice[]
     *
     * @ORM\ManyToMany(targetEntity="SolidInvoice\InvoiceBundle\Entity\Invoice", cascade={"persist"}, fetch="EXTRA_LAZY", mappedBy="users")
     */
    private $invoices;

    /**<commit_msg>Change email validator config from strict=true to mode=strict<commit_after><?php

declare(strict_types=1);

/*
 * This file is part of SolidInvoice project.
 *
 * (c) 2013-2017 <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace SolidInvoice\ClientBundle\Entity;

use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use SolidInvoice\CoreBundle\Traits\Entity;
use SolidInvoice\InvoiceBundle\Entity\Invoice;
use SolidInvoice\QuoteBundle\Entity\Quote;
use Symfony\Component\Serializer\Annotation as Serialize;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ApiResource(attributes={"normalization_context"={"groups"={"contact_api"}}, "denormalization_context"={"groups"={"contact_api"}}}, collectionOperations={"post"={"method"="POST"}}, iri="https://schema.org/Person")
 * @ORM\Table(name="contacts", indexes={@ORM\Index(columns={"email"})})
 * @ORM\Entity(repositoryClass="SolidInvoice\ClientBundle\Repository\ContactRepository")
 * @Gedmo\Loggable
 */
class Contact implements \Serializable
{
    use Entity\TimeStampable;

    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @Serialize\Groups({"client_api", "contact_api"})
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="firstName", type="string", length=125, nullable=false)
     * @Assert\NotBlank()
     * @Assert\Length(max=125)
     * @Serialize\Groups({"client_api", "contact_api"})
     * @ApiProperty(iri="https://schema.org/givenName")
     */
    private $firstName;

    /**
     * @var string
     *
     * @ORM\Column(name="lastName", type="string", length=125, nullable=true)
     * @Assert\Length(max=125)
     * @Serialize\Groups({"client_api", "contact_api"})
     * @ApiProperty(iri="https://schema.org/familyName")
     */
    private $lastName;

    /**
     * @var Client
     *
     * @ORM\ManyToOne(targetEntity="Client", inversedBy="contacts")
     * @ORM\JoinColumn(name="client_id", referencedColumnName="id")
     * @Serialize\Groups({"contact_api"})
     * @ApiProperty(iri="https://schema.org/Organization")
     * @Assert\Valid()
     * @Assert\NotBlank()
     */
    private $client;

    /**
     * @var string
     *
     * @ORM\Column(name="email", type="string", length=255)
     * @Assert\NotBlank()
     * @Assert\Email(mode="strict")
     * @Serialize\Groups({"client_api", "contact_api"})
     * @ApiProperty(iri="https://schema.org/email")
     */
    private $email;

    /**
     * @var Collection|AdditionalContactDetail[]
     *
     * @ORM\OneToMany(targetEntity="AdditionalContactDetail", mappedBy="contact", cascade={"persist", "remove"}, orphanRemoval=true)
     * @Assert\Valid()
     * @Serialize\Groups({"client_api", "contact_api"})
     */
    private $additionalContactDetails;

    /**
     * @var Collection|Invoice[]
     *
     * @ORM\ManyToMany(targetEntity="SolidInvoice\InvoiceBundle\Entity\Invoice", cascade={"persist"}, fetch="EXTRA_LAZY", mappedBy="users")
     */
    private $invoices;

    /**
{'fraction_non_alphanumeric': 0.1670171222589366, 'fraction_numerical': 0.00720937218383899, 'mean_word_length': 3.9107669616519174, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5432074', 'n_tokens_mistral': 2205, 'n_tokens_neox': 2114, 'n_words': 323}