for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Silverback API Component Bundle Project
*
* (c) Daniel West <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Silverback\ApiComponentBundle\Entity\Utility;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @author Vincent Chalamon <[email protected]>
trait PublishableTrait
{
* @Assert\NotNull
private ?\DateTimeInterface $publishedAt = null;
private ?self $publishedResource = null;
/** @return static */
public function setPublishedAt(?\DateTimeInterface $publishedAt)
$this->publishedAt = $publishedAt;
return $this;
}
public function getPublishedAt(): ?\DateTimeInterface
return $this->publishedAt;
public function isPublished(): bool
return null !== $this->publishedAt;
public function setPublishedResource($publishedResource)
$this->publishedResource = $publishedResource;
public function getPublishedResource(): ?self
return $this->publishedResource;