2015-03-22 17:22:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Skobkin\Bundle\PointToolsBundle\Entity;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscription
|
|
|
|
*
|
2015-10-01 18:45:16 +00:00
|
|
|
* @ORM\Table(name="subscriptions.subscriptions", schema="subscriptions", uniqueConstraints={
|
2015-05-28 17:36:52 +00:00
|
|
|
* @ORM\UniqueConstraint(name="subscription_unique", columns={"author_id", "subscriber_id"})}
|
|
|
|
* )
|
2015-06-23 09:38:43 +00:00
|
|
|
* @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Entity\SubscriptionRepository")
|
2015-03-22 17:22:49 +00:00
|
|
|
*/
|
|
|
|
class Subscription
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var User
|
|
|
|
*
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="subscribers")
|
|
|
|
* @ORM\JoinColumn(name="author_id")
|
|
|
|
*/
|
|
|
|
private $author;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var User
|
|
|
|
*
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="subscriptions")
|
|
|
|
* @ORM\JoinColumn(name="subscriber_id")
|
|
|
|
*/
|
|
|
|
private $subscriber;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set author
|
|
|
|
*
|
|
|
|
* @param User $author
|
|
|
|
* @return Subscription
|
|
|
|
*/
|
|
|
|
public function setAuthor(User $author = null)
|
|
|
|
{
|
|
|
|
$this->author = $author;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get author
|
|
|
|
*
|
|
|
|
* @return User
|
|
|
|
*/
|
|
|
|
public function getAuthor()
|
|
|
|
{
|
|
|
|
return $this->author;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set subscriber
|
|
|
|
*
|
|
|
|
* @param User $subscriber
|
|
|
|
* @return Subscription
|
|
|
|
*/
|
|
|
|
public function setSubscriber(User $subscriber = null)
|
|
|
|
{
|
|
|
|
$this->subscriber = $subscriber;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get subscriber
|
|
|
|
*
|
|
|
|
* @return User
|
|
|
|
*/
|
|
|
|
public function getSubscriber()
|
|
|
|
{
|
|
|
|
return $this->subscriber;
|
|
|
|
}
|
|
|
|
}
|