Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Model and repository for subscriber lists #218

Merged
merged 1 commit into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions Classes/Domain/Model/Messaging/SubscriberList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
<?php
declare(strict_types=1);

namespace PhpList\PhpList4\Domain\Model\Messaging;

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Proxy\Proxy;
use PhpList\PhpList4\Domain\Model\Identity\Administrator;
use PhpList\PhpList4\Domain\Model\Interfaces\CreationDate;
use PhpList\PhpList4\Domain\Model\Interfaces\Identity;
use PhpList\PhpList4\Domain\Model\Interfaces\ModificationDate;
use PhpList\PhpList4\Domain\Model\Traits\CreationDateTrait;
use PhpList\PhpList4\Domain\Model\Traits\IdentityTrait;
use PhpList\PhpList4\Domain\Model\Traits\ModificationDateTrait;

/**
* This class represents an administrator who can log to the system, is allowed to administer
* selected lists (as the owner), send campaigns to these lists and edit subscribers.
*
* @Entity(repositoryClass="PhpList\PhpList4\Domain\Repository\Messaging\SubscriberListRepository")
* @Table(name="phplist_list")
* @HasLifecycleCallbacks
*
* @author Oliver Klee <[email protected]>
*/
class SubscriberList implements Identity, CreationDate, ModificationDate
{
use IdentityTrait;
use CreationDateTrait;
use ModificationDateTrait;

/**
* @var string
* @Column
*/
private $name = '';

/**
* @var string
* @Column
*/
private $description = '';

/**
* @var \DateTime|null
* @Column(type="datetime", nullable=true, name="entered")
*/
protected $creationDate = null;

/**
* @var \DateTime|null
* @Column(type="datetime", nullable=true, name="modified")
*/
protected $modificationDate = null;

/**
* @var int
* @Column(type="integer", name="listorder")
*/
private $listPosition = 0;

/**
* @var string
* @Column(name="prefix")
*/
private $subjectPrefix = '';

/**
* @var bool
* @Column(type="boolean")
*/
private $active = false;

/**
* @var string
* @Column
*/
private $category = '';

/**
* @var Administrator
* @ManyToOne(targetEntity="PhpList\PhpList4\Domain\Model\Identity\Administrator")
* @JoinColumn(name="owner")
*/
private $owner = null;

/**
* @return string
*/
public function getName(): string
{
return $this->name;
}

/**
* @param string $name
*
* @return void
*/
public function setName(string $name)
{
$this->name = $name;
}

/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}

/**
* @param string $description
*
* @return void
*/
public function setDescription(string $description)
{
$this->description = $description;
}

/**
* @return int
*/
public function getListPosition(): int
{
return $this->listPosition;
}

/**
* @param int $listPosition
*
* @return void
*/
public function setListPosition(int $listPosition)
{
$this->listPosition = $listPosition;
}

/**
* @return string
*/
public function getSubjectPrefix(): string
{
return $this->subjectPrefix;
}

/**
* @param string $subjectPrefix
*
* @return void
*/
public function setSubjectPrefix(string $subjectPrefix)
{
$this->subjectPrefix = $subjectPrefix;
}

/**
* @return bool
*/
public function isActive(): bool
{
return $this->active;
}

/**
* @param bool $active
*
* @return void
*/
public function setActive(bool $active)
{
$this->active = $active;
}

/**
* @return string
*/
public function getCategory(): string
{
return $this->category;
}

/**
* @param string $category
*
* @return void
*/
public function setCategory(string $category)
{
$this->category = $category;
}

/**
* @return Administrator|Proxy|null
*/
public function getOwner()
{
return $this->owner;
}

/**
* @param Administrator $owner
*
* @return void
*/
public function setOwner(Administrator $owner)
{
$this->owner = $owner;
}
}
15 changes: 15 additions & 0 deletions Classes/Domain/Repository/Messaging/SubscriberListRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);

namespace PhpList\PhpList4\Domain\Repository\Messaging;

use PhpList\PhpList4\Domain\Repository\AbstractRepository;

/**
* Repository for SubscriberList models.
*
* @author Oliver Klee <[email protected]>
*/
class SubscriberListRepository extends AbstractRepository
{
}
5 changes: 5 additions & 0 deletions Configuration/repositories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ services:
parent: PhpList\PhpList4\Domain\Repository
arguments:
- PhpList\PhpList4\Domain\Model\Identity\AdministratorToken

PhpList\PhpList4\Domain\Repository\Messaging\SubscriberListRepository:
parent: PhpList\PhpList4\Domain\Repository
arguments:
- PhpList\PhpList4\Domain\Model\Messaging\SubscriberList
8 changes: 4 additions & 4 deletions Documentation/DomainModel/DomainModel.dot
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ digraph phpListDomainModel {
CampaignBounce [label = "CampaignBounce"]
CampaignData [label = "CampaignData"]
CampaignForward [label = "CampaignForward"]
List [label = "List"]
SubscriberList [label = "SubscriberList"]
Template [label = "Template"]
TemplateImage [label = "TemplateImage"]
}
Expand Down Expand Up @@ -125,8 +125,8 @@ digraph phpListDomainModel {
LinkTrackMessageLink -> LinkTrackForward [taillabel="*" headlabel="1"]
LinkTrackUmlClick -> LinkTrackMessageLink [taillabel="*" headlabel="1"]
LinkTrackUmlClick -> Subscriber [taillabel="*" headlabel="1"]
List -> Campaign [taillabel="*" headlabel="*"]
List -> Subscription [taillabel="1" headlabel="*"]
SubscriberList:s -> Campaign [taillabel="*" headlabel="*"]
SubscriberList:sw -> Subscription [taillabel="1" headlabel="*"]
SubscribePage -> SubscribePageData [taillabel="1" headlabel="*"]
Subscriber -> CampaignForward [taillabel="1" headlabel="*"]
Subscriber -> SubscriberAttributeValue [taillabel="1" headlabel="*"]
Expand All @@ -146,7 +146,7 @@ digraph phpListDomainModel {
dir = ""
]

List -> Administrator [taillabel="*" headlabel="1" label="owner"]
SubscriberList -> Administrator [taillabel="*" headlabel="1" label="owner"]


//
Expand Down
Loading