vendor/sulu/sulu/src/Sulu/Bundle/PageBundle/Document/BasePageDocument.php line 266

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\PageBundle\Document;
  11. use Sulu\Component\Content\Document\Behavior\ExtensionBehavior;
  12. use Sulu\Component\Content\Document\Behavior\LocalizedAuditableBehavior;
  13. use Sulu\Component\Content\Document\Behavior\LocalizedAuthorBehavior;
  14. use Sulu\Component\Content\Document\Behavior\LocalizedStructureBehavior;
  15. use Sulu\Component\Content\Document\Behavior\NavigationContextBehavior;
  16. use Sulu\Component\Content\Document\Behavior\OrderBehavior;
  17. use Sulu\Component\Content\Document\Behavior\RedirectTypeBehavior;
  18. use Sulu\Component\Content\Document\Behavior\ResourceSegmentBehavior;
  19. use Sulu\Component\Content\Document\Behavior\SecurityBehavior;
  20. use Sulu\Component\Content\Document\Behavior\ShadowLocaleBehavior;
  21. use Sulu\Component\Content\Document\Behavior\WebspaceBehavior;
  22. use Sulu\Component\Content\Document\Behavior\WorkflowStageBehavior;
  23. use Sulu\Component\Content\Document\Extension\ExtensionContainer;
  24. use Sulu\Component\Content\Document\RedirectType;
  25. use Sulu\Component\Content\Document\Structure\Structure;
  26. use Sulu\Component\Content\Document\Structure\StructureInterface;
  27. use Sulu\Component\Content\Document\WorkflowStage;
  28. use Sulu\Component\DocumentManager\Behavior\Mapping\ChildrenBehavior;
  29. use Sulu\Component\DocumentManager\Behavior\Mapping\LocalizedTitleBehavior;
  30. use Sulu\Component\DocumentManager\Behavior\Mapping\NodeNameBehavior;
  31. use Sulu\Component\DocumentManager\Behavior\Mapping\PathBehavior;
  32. use Sulu\Component\DocumentManager\Behavior\Mapping\UuidBehavior;
  33. use Sulu\Component\DocumentManager\Behavior\VersionBehavior;
  34. use Sulu\Component\DocumentManager\Collection\ChildrenCollection;
  35. use Sulu\Component\DocumentManager\Version;
  36. /**
  37.  * Base document for Page-like documents (i.e. Page and Home documents).
  38.  */
  39. class BasePageDocument implements
  40.     NodeNameBehavior,
  41.     LocalizedStructureBehavior,
  42.     ResourceSegmentBehavior,
  43.     NavigationContextBehavior,
  44.     RedirectTypeBehavior,
  45.     WorkflowStageBehavior,
  46.     ShadowLocaleBehavior,
  47.     UuidBehavior,
  48.     ChildrenBehavior,
  49.     PathBehavior,
  50.     ExtensionBehavior,
  51.     OrderBehavior,
  52.     WebspaceBehavior,
  53.     SecurityBehavior,
  54.     LocalizedAuditableBehavior,
  55.     LocalizedTitleBehavior,
  56.     VersionBehavior,
  57.     LocalizedAuthorBehavior
  58. {
  59.     public const RESOURCE_KEY 'pages';
  60.     /**
  61.      * The name of this node.
  62.      *
  63.      * @var string
  64.      */
  65.     protected $nodeName;
  66.     /**
  67.      * Datetime of create document.
  68.      *
  69.      * @var \DateTime
  70.      */
  71.     protected $created;
  72.     /**
  73.      * Changed date of page.
  74.      *
  75.      * @var \DateTime
  76.      */
  77.     protected $changed;
  78.     /**
  79.      * User ID of creator.
  80.      *
  81.      * @var int|null
  82.      */
  83.     protected $creator;
  84.     /**
  85.      * User ID of changer.
  86.      *
  87.      * @var int|null
  88.      */
  89.     protected $changer;
  90.     /**
  91.      * Title of document.
  92.      *
  93.      * @var string
  94.      */
  95.     protected $title;
  96.     /**
  97.      * Segment.
  98.      *
  99.      * @var string
  100.      */
  101.     protected $resourceSegment;
  102.     /**
  103.      * @var string[]
  104.      */
  105.     protected $navigationContexts = [];
  106.     /**
  107.      * Type of redirection.
  108.      *
  109.      * @var int
  110.      */
  111.     protected $redirectType;
  112.     /**
  113.      * The target of redirection.
  114.      *
  115.      * @var object|null
  116.      */
  117.     protected $redirectTarget;
  118.     /**
  119.      * The External redirect.
  120.      *
  121.      * @var string|null
  122.      */
  123.     protected $redirectExternal;
  124.     /**
  125.      * Workflow Stage currently Test or Published.
  126.      *
  127.      * @var int
  128.      */
  129.     protected $workflowStage;
  130.     /**
  131.      * Is Document is published.
  132.      *
  133.      * @var bool
  134.      */
  135.     protected $published;
  136.     /**
  137.      * Shadow locale is enabled.
  138.      *
  139.      * @var bool
  140.      */
  141.     protected $shadowLocaleEnabled false;
  142.     /**
  143.      * Shadow locale.
  144.      *
  145.      * @var string|null
  146.      */
  147.     protected $shadowLocale;
  148.     /**
  149.      * Universal Identifier.
  150.      *
  151.      * @var string
  152.      */
  153.     protected $uuid;
  154.     /**
  155.      * Document's type of structure ie default, complex...
  156.      *
  157.      * @var string
  158.      */
  159.     protected $structureType;
  160.     /**
  161.      * Structure.
  162.      *
  163.      * @var StructureInterface
  164.      */
  165.     protected $structure;
  166.     /**
  167.      * Document's locale.
  168.      *
  169.      * @var string
  170.      */
  171.     protected $locale;
  172.     /**
  173.      * Document's original locale.
  174.      *
  175.      * @var string
  176.      */
  177.     protected $originalLocale;
  178.     /**
  179.      * Document's children.
  180.      *
  181.      * @var ChildrenCollection
  182.      */
  183.     protected $children;
  184.     /**
  185.      * Path of Document.
  186.      *
  187.      * @var string
  188.      */
  189.     protected $path;
  190.     /**
  191.      * Document's extensions ie seo, ...
  192.      *
  193.      * @var array<mixed[]>|ExtensionContainer
  194.      */
  195.     protected $extensions;
  196.     /**
  197.      * Document's webspace name.
  198.      *
  199.      * @var string
  200.      */
  201.     protected $webspaceName;
  202.     /**
  203.      * Document's order.
  204.      *
  205.      * @var int
  206.      */
  207.     protected $suluOrder;
  208.     /**
  209.      * List of permissions.
  210.      *
  211.      * @var array
  212.      */
  213.     protected $permissions = [];
  214.     /**
  215.      * List of versions.
  216.      *
  217.      * @var Version[]
  218.      */
  219.     protected $versions = [];
  220.     /**
  221.      * Date of authoring.
  222.      *
  223.      * @var \DateTime
  224.      */
  225.     protected $authored;
  226.     /**
  227.      * Id of author.
  228.      *
  229.      * @var int|null
  230.      */
  231.     protected $author;
  232.     public function __construct()
  233.     {
  234.         $this->workflowStage WorkflowStage::TEST;
  235.         $this->redirectType RedirectType::NONE;
  236.         $this->structure = new Structure();
  237.         $this->extensions = new ExtensionContainer();
  238.         $this->children = new \ArrayIterator();
  239.     }
  240.     public function getNodeName()
  241.     {
  242.         return $this->nodeName;
  243.     }
  244.     public function getTitle()
  245.     {
  246.         return $this->title;
  247.     }
  248.     public function setTitle($title)
  249.     {
  250.         $this->title $title;
  251.     }
  252.     public function getCreated()
  253.     {
  254.         return $this->created;
  255.     }
  256.     /**
  257.      * @param \DateTime $created
  258.      *
  259.      * @return void
  260.      */
  261.     public function setCreated($created)
  262.     {
  263.         $this->created $created;
  264.     }
  265.     public function getChanged()
  266.     {
  267.         return $this->changed;
  268.     }
  269.     public function getCreator()
  270.     {
  271.         return $this->creator;
  272.     }
  273.     /**
  274.      * @param int|null $userId
  275.      *
  276.      * @return void
  277.      */
  278.     public function setCreator($userId)
  279.     {
  280.         $this->creator $userId;
  281.     }
  282.     public function getChanger()
  283.     {
  284.         return $this->changer;
  285.     }
  286.     public function getResourceSegment()
  287.     {
  288.         return $this->resourceSegment;
  289.     }
  290.     public function setResourceSegment($resourceSegment)
  291.     {
  292.         $this->resourceSegment $resourceSegment;
  293.     }
  294.     public function getNavigationContexts()
  295.     {
  296.         return $this->navigationContexts;
  297.     }
  298.     public function setNavigationContexts(array $navigationContexts = [])
  299.     {
  300.         $this->navigationContexts $navigationContexts;
  301.     }
  302.     public function getRedirectType()
  303.     {
  304.         return $this->redirectType;
  305.     }
  306.     public function setRedirectType($redirectType)
  307.     {
  308.         $this->redirectType $redirectType;
  309.     }
  310.     public function getRedirectTarget()
  311.     {
  312.         return $this->redirectTarget;
  313.     }
  314.     public function setRedirectTarget($redirectTarget)
  315.     {
  316.         $this->redirectTarget $redirectTarget;
  317.     }
  318.     public function getRedirectExternal()
  319.     {
  320.         return $this->redirectExternal;
  321.     }
  322.     public function setRedirectExternal($redirectExternal)
  323.     {
  324.         $this->redirectExternal $redirectExternal;
  325.     }
  326.     public function getWorkflowStage()
  327.     {
  328.         return $this->workflowStage;
  329.     }
  330.     public function setWorkflowStage($workflowStage)
  331.     {
  332.         $this->workflowStage $workflowStage;
  333.     }
  334.     public function getPublished()
  335.     {
  336.         return $this->published;
  337.     }
  338.     public function getShadowLocale()
  339.     {
  340.         return $this->shadowLocale;
  341.     }
  342.     public function setShadowLocale($shadowLocale)
  343.     {
  344.         $this->shadowLocale $shadowLocale;
  345.     }
  346.     public function isShadowLocaleEnabled()
  347.     {
  348.         return $this->shadowLocaleEnabled;
  349.     }
  350.     public function setShadowLocaleEnabled($shadowLocaleEnabled)
  351.     {
  352.         $this->shadowLocaleEnabled $shadowLocaleEnabled;
  353.     }
  354.     public function getUuid()
  355.     {
  356.         return $this->uuid;
  357.     }
  358.     public function getStructureType()
  359.     {
  360.         return $this->structureType;
  361.     }
  362.     public function getStructure()
  363.     {
  364.         return $this->structure;
  365.     }
  366.     public function setStructureType($structureType)
  367.     {
  368.         $this->structureType $structureType;
  369.     }
  370.     public function getLocale()
  371.     {
  372.         return $this->locale;
  373.     }
  374.     public function setLocale($locale)
  375.     {
  376.         $this->locale $locale;
  377.     }
  378.     public function getOriginalLocale()
  379.     {
  380.         return $this->originalLocale;
  381.     }
  382.     public function setOriginalLocale($originalLocale)
  383.     {
  384.         $this->originalLocale $originalLocale;
  385.     }
  386.     public function getChildren()
  387.     {
  388.         return $this->children;
  389.     }
  390.     public function getPath()
  391.     {
  392.         return $this->path;
  393.     }
  394.     public function getExtensionsData()
  395.     {
  396.         return $this->extensions;
  397.     }
  398.     public function setExtensionsData($extensions)
  399.     {
  400.         $this->extensions $extensions;
  401.     }
  402.     public function setExtension($name$data)
  403.     {
  404.         $this->extensions[$name] = $data;
  405.     }
  406.     public function getWebspaceName()
  407.     {
  408.         return $this->webspaceName;
  409.     }
  410.     public function getSuluOrder()
  411.     {
  412.         return $this->suluOrder;
  413.     }
  414.     public function setSuluOrder($order)
  415.     {
  416.         $this->suluOrder $order;
  417.     }
  418.     public function setPermissions(array $permissions)
  419.     {
  420.         $this->permissions $permissions;
  421.     }
  422.     public function getPermissions()
  423.     {
  424.         return $this->permissions;
  425.     }
  426.     public function getVersions()
  427.     {
  428.         return $this->versions;
  429.     }
  430.     public function setVersions($versions)
  431.     {
  432.         $this->versions $versions;
  433.     }
  434.     public function getAuthored()
  435.     {
  436.         return $this->authored;
  437.     }
  438.     /**
  439.      * @param \DateTime $authored
  440.      *
  441.      * @return void
  442.      */
  443.     public function setAuthored($authored)
  444.     {
  445.         $this->authored $authored;
  446.     }
  447.     public function getAuthor()
  448.     {
  449.         return $this->author;
  450.     }
  451.     /**
  452.      * @param int|null $contactId
  453.      *
  454.      * @return void
  455.      */
  456.     public function setAuthor($contactId)
  457.     {
  458.         $this->author $contactId;
  459.     }
  460. }