<commit_before><?php

namespace MailerModule\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use MailerModule\MailStatus;
use MailerModule\RecipientType;

/**
 * @Entity
 * @Table(
 *     name="mailer_messages",
 *     indexes={
 *         @Index(columns={"campaign_id"}),
 *         @Index(columns={"status", "priority", "created_at"})
 *     }
 * )
 */
class Message
{
    /**
     * @Id
     * @Column(name="message_id", type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ManyToOne(targetEntity="MailerModule\Entity\Campaign")
     * @JoinColumn(name="campaign_id", referencedColumnName="campaign_id")
     * @var \MailerModule\Entity\Campaign
     */
    protected $campaign;

    /**
     * @Column(name="created_at", type="epoch")
     * @var \DateTime
     */
    protected $createdAt;

    /**
     * @Column(name="locked_at", type="epoch", nullable=true)
     * @var \DateTime
     */
    protected $lockedAt;

    /**
     * @Column(name="sent_at", type="epoch", nullable=true)
     * @var \DateTime
     */
    protected $sentAt;

    /**
     * @Column(name="read_at", type="epoch", nullable=true)
     * @var \DateTime
     */
    protected $readAt;

    /**
     * @Column(name="priority", type="smallint", options={"default"=0})
     * @var int
     */
    protected $priority = 0;

    /**
     * @Column(name="fail_count", type="smallint", options={"default"=0})
     * @var int
     */
    protected $failCount = 0;

    /**
     * @Column(name="status", type="string", length=32)
     * @var string
     */
    protected $status = MailStatus::PENDING;

    /**
     * @Column(name="lock_key", type="string", length=64, nullable=true, unique=true)
     * @var string
     */
    protected $lockKey;

    /**
     * @Column(name="tracking_key", type="string", length=64, nullable=true, unique=true)
     * @var string
     */
    protected $trackingKey;

    /**
     * @Column(name="reply_to_email", type="string", length=255, nullable=true)
     */
    protected $replyToEmail;

    /**
     * @Column(name="reply_to_name", type="string", length=255, nullable=true)
     * @var string
     */
    protected $replyToName;

    /**
     * @Column(name="subject", type="string", length=255)
     * @var string
     */
    protected $subject;

    /**
     * @Column(name="content_type", type="string", length=16)
     * @var string
     */
    protected $contentType;

    /**
     * @Column(name="content", type="text")
     * @var string
     */
    protected $content;

    /**
     * @OneToMany(targetEntity="MailerModule\Entity\Recipient", mappedBy="message")
     * @var \Doctrine\Common\Collections\ArrayCollection
     */
    protected $recipients;

    public function __construct()
    {
        $this->recipients = new ArrayCollection();

        $this->setCreatedAt(new \DateTime('now'));
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param mixed $id
     * @return Message<commit_msg>Configured recipient persisting<commit_after><?php

namespace MailerModule\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use MailerModule\MailStatus;
use MailerModule\RecipientType;

/**
 * @Entity
 * @Table(
 *     name="mailer_messages",
 *     indexes={
 *         @Index(columns={"campaign_id"}),
 *         @Index(columns={"status", "priority", "created_at"})
 *     }
 * )
 */
class Message
{
    /**
     * @Id
     * @Column(name="message_id", type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ManyToOne(targetEntity="MailerModule\Entity\Campaign")
     * @JoinColumn(name="campaign_id", referencedColumnName="campaign_id")
     * @var \MailerModule\Entity\Campaign
     */
    protected $campaign;

    /**
     * @Column(name="created_at", type="epoch")
     * @var \DateTime
     */
    protected $createdAt;

    /**
     * @Column(name="locked_at", type="epoch", nullable=true)
     * @var \DateTime
     */
    protected $lockedAt;

    /**
     * @Column(name="sent_at", type="epoch", nullable=true)
     * @var \DateTime
     */
    protected $sentAt;

    /**
     * @Column(name="read_at", type="epoch", nullable=true)
     * @var \DateTime
     */
    protected $readAt;

    /**
     * @Column(name="priority", type="smallint", options={"default"=0})
     * @var int
     */
    protected $priority = 0;

    /**
     * @Column(name="fail_count", type="smallint", options={"default"=0})
     * @var int
     */
    protected $failCount = 0;

    /**
     * @Column(name="status", type="string", length=32)
     * @var string
     */
    protected $status = MailStatus::PENDING;

    /**
     * @Column(name="lock_key", type="string", length=64, nullable=true, unique=true)
     * @var string
     */
    protected $lockKey;

    /**
     * @Column(name="tracking_key", type="string", length=64, nullable=true, unique=true)
     * @var string
     */
    protected $trackingKey;

    /**
     * @Column(name="reply_to_email", type="string", length=255, nullable=true)
     */
    protected $replyToEmail;

    /**
     * @Column(name="reply_to_name", type="string", length=255, nullable=true)
     * @var string
     */
    protected $replyToName;

    /**
     * @Column(name="subject", type="string", length=255)
     * @var string
     */
    protected $subject;

    /**
     * @Column(name="content_type", type="string", length=16)
     * @var string
     */
    protected $contentType;

    /**
     * @Column(name="content", type="text")
     * @var string
     */
    protected $content;

    /**
     * @OneToMany(targetEntity="MailerModule\Entity\Recipient", mappedBy="message", cascade={"persist", "remove"})
     * @var \Doctrine\Common\Collections\ArrayCollection
     */
    protected $recipients;

    public function __construct()
    {
        $this->recipients = new ArrayCollection();

        $this->setCreatedAt(new \DateTime('now'));
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param mixed $id
     * @return Message
{'fraction_non_alphanumeric': 0.17238017871649067, 'fraction_numerical': 0.006823720552396426, 'mean_word_length': 2.602106495026331, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '328279', 'n_tokens_mistral': 2027, 'n_tokens_neox': 1947, 'n_words': 325}