<?php
/**
* Inheritance: no
* Variants: no
*
* Fields Summary:
* - localizedfields [localizedfields]
* -- name [input]
* - sorting [numeric]
* - hidden [checkbox]
* - legacyId [input]
*/
namespace Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Exception\InheritanceParentNotFoundException;
use Pimcore\Model\DataObject\PreGetValueHookInterface;
/**
* @method static \Pimcore\Model\DataObject\MediaCategory\Listing getList(array $config = [])
* @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByLocalizedfields($field, $value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByName($value, $locale = null, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getBySorting($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByHidden($value, $limit = 0, $offset = 0, $objectTypes = null)
* @method static \Pimcore\Model\DataObject\MediaCategory\Listing|\Pimcore\Model\DataObject\MediaCategory|null getByLegacyId($value, $limit = 0, $offset = 0, $objectTypes = null)
*/
class MediaCategory extends Concrete
{
protected $o_classId = "MediaCategory";
protected $o_className = "MediaCategory";
protected $localizedfields;
protected $sorting;
protected $hidden;
protected $legacyId;
/**
* @param array $values
* @return \Pimcore\Model\DataObject\MediaCategory
*/
public static function create($values = array()) {
$object = new static();
$object->setValues($values);
return $object;
}
/**
* Get localizedfields -
* @return \Pimcore\Model\DataObject\Localizedfield|null
*/
public function getLocalizedfields()
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("localizedfields");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->getClass()->getFieldDefinition("localizedfields")->preGetData($this);
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Get name - Name
* @return string|null
*/
public function getName($language = null)
{
$data = $this->getLocalizedfields()->getLocalizedValue("name", $language);
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("name");
if ($preValue !== null) {
return $preValue;
}
}
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set localizedfields -
* @param \Pimcore\Model\DataObject\Localizedfield|null $localizedfields
* @return \Pimcore\Model\DataObject\MediaCategory
*/
public function setLocalizedfields($localizedfields)
{
$hideUnpublished = \Pimcore\Model\DataObject\Concrete::getHideUnpublished();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished(false);
$currentData = $this->getLocalizedfields();
\Pimcore\Model\DataObject\Concrete::setHideUnpublished($hideUnpublished);
$this->markFieldDirty("localizedfields", true);
$this->localizedfields = $localizedfields;
return $this;
}
/**
* Set name - Name
* @param string|null $name
* @return \Pimcore\Model\DataObject\MediaCategory
*/
public function setName ($name, $language = null)
{
$isEqual = false;
$this->getLocalizedfields()->setLocalizedValue("name", $name, $language, !$isEqual);
return $this;
}
/**
* Get sorting - Sortierung
* @return float|null
*/
public function getSorting()
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("sorting");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->sorting;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set sorting - Sortierung
* @param float|null $sorting
* @return \Pimcore\Model\DataObject\MediaCategory
*/
public function setSorting($sorting)
{
/** @var \Pimcore\Model\DataObject\ClassDefinition\Data\Numeric $fd */
$fd = $this->getClass()->getFieldDefinition("sorting");
$this->sorting = $fd->preSetData($this, $sorting);
return $this;
}
/**
* Get hidden - versteckt
* @return bool|null
*/
public function getHidden()
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("hidden");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->hidden;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set hidden - versteckt
* @param bool|null $hidden
* @return \Pimcore\Model\DataObject\MediaCategory
*/
public function setHidden($hidden)
{
$this->hidden = $hidden;
return $this;
}
/**
* Get legacyId - Legacy Id
* @return string|null
*/
public function getLegacyId()
{
if ($this instanceof PreGetValueHookInterface && !\Pimcore::inAdmin()) {
$preValue = $this->preGetValue("legacyId");
if ($preValue !== null) {
return $preValue;
}
}
$data = $this->legacyId;
if ($data instanceof \Pimcore\Model\DataObject\Data\EncryptedField) {
return $data->getPlain();
}
return $data;
}
/**
* Set legacyId - Legacy Id
* @param string|null $legacyId
* @return \Pimcore\Model\DataObject\MediaCategory
*/
public function setLegacyId($legacyId)
{
$this->legacyId = $legacyId;
return $this;
}
}