<?php
/**
* Inheritance: no
* Variants: no
*
* Fields Summary:
* - date [date]
* - Category [manyToManyRelation]
* - headline [textarea]
* - intro [textarea]
* - content [fieldcollections]
* - teaserImage [manyToOneRelation]
* - shadowImage [image]
*/
namespace Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
use Pimcore\Model\DataObject\PreGetValueHookInterface;
/**
* @method static \Pimcore\Model\DataObject\News\Listing getList(array $config = [])
* @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByDate($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByCategory($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByHeadline($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByIntro($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByTeaserImage($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\News\Listing|\Pimcore\Model\DataObject\News|null getByShadowImage($value, $limit = 0, $offset = 0, $objectTypes = null)
*/
class News extends Concrete
{
protected $o_classId = "News";
protected $o_className = "News";
protected $date;
protected $Category;
protected $headline;
protected $intro;
protected $content;
protected $teaserImage;
protected $shadowImage;
/**
* @param array $values
* @return \Pimcore\Model\DataObject\News
*/
public static function create($values = array()) {
$object = new static();
$object->setValues($values);
return $object;
}
/**
* Get date - Date
* @return \Carbon\Carbon|null
*/
public function getDate(): ?\Carbon\Carbon
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("date");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->date;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set date - Date
* @param \Carbon\Carbon|null $date
* @return \Pimcore\Model\DataObject\News
*/
public function setDate(?\Carbon\Carbon $date)
{
$this->date = $date;
return $this;
}
/**
* Get Category - Category
* @return \Pimcore\Model\DataObject\Category[]
*/
public function getCategory(): array
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("Category");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("Category")->preGetData($this);
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set Category - Category
* @param \Pimcore\Model\DataObject\Category[] $Category
* @return \Pimcore\Model\DataObject\News
*/
public function setCategory(?array $Category)
{
/** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToManyRelation $fd */
$fd = $this->getClass()->getFieldDefinition("Category");
$hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
$currentData = $this->getCategory();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
$isEqual = $fd->isEqual($currentData, $Category);
if (!$isEqual) {
$this->markFieldDirty("Category", true);
}
$this->Category = $fd->preSetData($this, $Category);
return $this;
}
/**
* Get headline - Headline
* @return string|null
*/
public function getHeadline(): ?string
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("headline");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->headline;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set headline - Headline
* @param string|null $headline
* @return \Pimcore\Model\DataObject\News
*/
public function setHeadline(?string $headline)
{
$this->headline = $headline;
return $this;
}
/**
* Get intro - Intro
* @return string|null
*/
public function getIntro(): ?string
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("intro");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->intro;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set intro - Intro
* @param string|null $intro
* @return \Pimcore\Model\DataObject\News
*/
public function setIntro(?string $intro)
{
$this->intro = $intro;
return $this;
}
/**
* @return \Pimcore\Model\DataObject\Fieldcollection|null
*/
public function getContent(): ?\Pimcore\Model\DataObject\Fieldcollection
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("content");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("content")->preGetData($this);
return $data;
}
/**
* Set content - Content
* @param \Pimcore\Model\DataObject\Fieldcollection|null $content
* @return \Pimcore\Model\DataObject\News
*/
public function setContent(?\Pimcore\Model\DataObject\Fieldcollection $content)
{
/** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Fieldcollections $fd */
$fd = $this->getClass()->getFieldDefinition("content");
$this->content = $fd->preSetData($this, $content);
return $this;
}
/**
* Get teaserImage - Teaser Image
* @return \Pimcore\Model\Asset\Image|null
*/
public function getTeaserImage(): ?\Pimcore\Model\Element\AbstractElement
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("teaserImage");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("teaserImage")->preGetData($this);
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set teaserImage - Teaser Image
* @param \Pimcore\Model\Asset\Image|null $teaserImage
* @return \Pimcore\Model\DataObject\News
*/
public function setTeaserImage(?\Pimcore\Model\Element\AbstractElement $teaserImage)
{
/** @var \Pimcore\Model\DataObject\ClassDefinition\Data\ManyToOneRelation $fd */
$fd = $this->getClass()->getFieldDefinition("teaserImage");
$hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
$currentData = $this->getTeaserImage();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
$isEqual = $fd->isEqual($currentData, $teaserImage);
if (!$isEqual) {
$this->markFieldDirty("teaserImage", true);
}
$this->teaserImage = $fd->preSetData($this, $teaserImage);
return $this;
}
/**
* Get shadowImage - Shadow Image
* @return \Pimcore\Model\Asset\Image|null
*/
public function getShadowImage(): ?\Pimcore\Model\Asset\Image
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("shadowImage");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->shadowImage;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set shadowImage - Shadow Image
* @param \Pimcore\Model\Asset\Image|null $shadowImage
* @return \Pimcore\Model\DataObject\News
*/
public function setShadowImage(?\Pimcore\Model\Asset\Image $shadowImage)
{
$this->shadowImage = $shadowImage;
return $this;
}
}