app/Plugin/CMBlogPro42/Entity/Blog.php line 20

Open in your IDE?
  1. <?php
  2. namespace Plugin\CMBlogPro42\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. if (!class_exists('\Plugin\CMBlogPro42\Entity\Blog')) {
  7.     /**
  8.      * Blog
  9.      *
  10.      * @ORM\Table(name="plg_blog_data")
  11.      * @ORM\InheritanceType("SINGLE_TABLE")
  12.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  13.      * @ORM\HasLifecycleCallbacks()
  14.      * @ORM\Entity(repositoryClass="Plugin\CMBlogPro42\Repository\BlogRepository")
  15.      * @UniqueEntity("slug")
  16.      */
  17.     class Blog extends \Eccube\Entity\AbstractEntity
  18.     {
  19.         /**
  20.          * @return string
  21.          */
  22.         public function __toString()
  23.         {
  24.             return (string) $this->getTitle();
  25.         }
  26.         /**
  27.          * Is Enable
  28.          *
  29.          * @return bool
  30.          *
  31.          * @deprecated
  32.          */
  33.         public function isEnable()
  34.         {
  35.             return $this->getStatus()->getId() === \Plugin\CMBlogPro42\Entity\BlogStatus::DISPLAY_SHOW true false;
  36.         }
  37.         public function getMainListImage()
  38.         {
  39.             $BlogImages $this->getBlogImage();
  40.             return empty($BlogImages) ? null $BlogImages[0];
  41.         }
  42.         public function getMainFileName()
  43.         {
  44.             if (count($this->BlogImage) > 0) {
  45.                 return $this->BlogImage[0];
  46.             } else {
  47.                 return null;
  48.             }
  49.         }
  50.         
  51.         /**
  52.          * @var int
  53.          *
  54.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  55.          * @ORM\Id
  56.          * @ORM\GeneratedValue(strategy="IDENTITY")
  57.          */
  58.         private $id;
  59.         /**
  60.          * @var string
  61.          *
  62.          * @ORM\Column(name="title", type="string", length=200)
  63.          */
  64.         private $title;
  65.         /**
  66.          * @var int
  67.          *
  68.          * @ORM\Column(name="members", type="integer" , nullable=true)
  69.          */
  70.         private $members;
  71.         /**
  72.          * @var text
  73.          *
  74.          * @ORM\Column(name="linkurl", type="text" , nullable=true)
  75.          */
  76.         private $linkurl;
  77.         /**
  78.          * @var string
  79.          *
  80.          * @ORM\Column(type="string", length=255, nullable=true, unique=true)
  81.          */
  82.         private $slug;
  83.         /**
  84.          * @var \Doctrine\Common\Collections\Collection
  85.          *
  86.          * @ORM\OneToMany(targetEntity="Plugin\CMBlogPro42\Entity\BlogCategory", mappedBy="Blog", cascade={"persist","remove"})
  87.          */
  88.         private $BlogCategories;
  89.         /**
  90.          * @var \Doctrine\Common\Collections\Collection
  91.          *
  92.          * @ORM\OneToMany(targetEntity="Plugin\CMBlogPro42\Entity\BlogShare", mappedBy="Blog", cascade={"persist","remove"})
  93.          */
  94.         private $BlogShares;
  95.         /**
  96.          * @var \Doctrine\Common\Collections\Collection
  97.          *
  98.          * @ORM\OneToMany(targetEntity="Plugin\CMBlogPro42\Entity\BlogImage", mappedBy="Blog", cascade={"remove"})
  99.          * @ORM\OrderBy({
  100.          *     "sort_no"="ASC"
  101.          * })
  102.          */
  103.         private $BlogImage;
  104.         /**
  105.          * @var \Doctrine\Common\Collections\Collection
  106.          *
  107.          * @ORM\OneToMany(targetEntity="Plugin\CMBlogPro42\Entity\BlogProduct", mappedBy="Blog", cascade={"persist","remove"})
  108.          */
  109.         private $BlogProduct;
  110.         /**
  111.          * @var string|null
  112.          *
  113.          * @ORM\Column(name="fig_caption", type="string", length=255, nullable=true)
  114.          */
  115.         private $fig_caption;
  116.         /**
  117.          * @var text|null
  118.          *
  119.          * @ORM\Column(name="body", type="text", nullable=true)
  120.          */
  121.         private $body;
  122.         /**
  123.          * @var string|null
  124.          *
  125.          * @ORM\Column(name="author", type="string", length=255, nullable=true)
  126.          */
  127.         private $author;
  128.         /**
  129.          * @var string|null
  130.          *
  131.          * @ORM\Column(name="description", type="string", length=255, nullable=true)
  132.          */
  133.         private $description;
  134.         /**
  135.          * @var string|null
  136.          *
  137.          * @ORM\Column(name="keyword", type="string", length=255, nullable=true)
  138.          */
  139.         private $keyword;
  140.         /**
  141.          * @var string|null
  142.          *
  143.          * @ORM\Column(name="meta_robots", type="string", length=255, nullable=true)
  144.          */
  145.         private $robot;
  146.         /**
  147.          * @var string|null
  148.          *
  149.          * @ORM\Column(name="meta_tags", type="text", nullable=true)
  150.          */
  151.         private $metatag;
  152.         /**
  153.          * @var \DateTime
  154.          *
  155.          * @ORM\Column(name="release_date", type="datetime", nullable=true)
  156.          */
  157.         private $release_date;
  158.         /**
  159.          * @var \DateTime
  160.          *
  161.          * @ORM\Column(name="create_date", type="datetime")
  162.          */
  163.         private $create_date;
  164.         /**
  165.          * @var \DateTime
  166.          *
  167.          * @ORM\Column(name="update_date", type="datetime")
  168.          */
  169.         private $update_date;
  170.         /**
  171.          * @var \Eccube\Entity\Member
  172.          *
  173.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
  174.          * @ORM\JoinColumns({
  175.          *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
  176.          * })
  177.          */
  178.         private $Creator;
  179.         /**
  180.          * @var \Plugin\CMBlogPro42\Entity\BlogStatus
  181.          *
  182.          * @ORM\ManyToOne(targetEntity="Plugin\CMBlogPro42\Entity\BlogStatus")
  183.          * @ORM\JoinColumns({
  184.          *   @ORM\JoinColumn(name="blog_status_id", referencedColumnName="id")
  185.          * })
  186.          */
  187.         private $Status;
  188.         /**
  189.          * @var tag|null
  190.          *
  191.          * @ORM\Column(name="tag", type="text", nullable=true)
  192.          */
  193.         private $tag;
  194.         /**
  195.          * Constructor
  196.          */
  197.         public function __construct()
  198.         {
  199.             $this->BlogCategories = new \Doctrine\Common\Collections\ArrayCollection();
  200.             $this->BlogShares = new \Doctrine\Common\Collections\ArrayCollection();
  201.             $this->BlogProduct = new \Doctrine\Common\Collections\ArrayCollection();
  202.             $this->BlogImage = new \Doctrine\Common\Collections\ArrayCollection();
  203.         }
  204.         public function __clone()
  205.         {
  206.             $this->id null;
  207.         }
  208.         public function copy()
  209.         {
  210.             // コピー対象外
  211.             $Categories $this->getBlogCategories();
  212.             $this->BlogCategories = new ArrayCollection();
  213.             foreach ($Categories as $Category) {
  214.                 $CopyCategory = clone $Category;
  215.                 $this->addBlogCategory($CopyCategory);
  216.                 $CopyCategory->setBlog($this);
  217.             }
  218.             
  219.             $Shares $this->getBlogShares();
  220.             $this->BlogShares = new ArrayCollection();
  221.             foreach ($Shares as $Share) {
  222.                 $CopyShare = clone $Share;
  223.                 $this->addBlogShare($CopyShare);
  224.                 $CopyShare->setBlog($this);
  225.             }
  226.             
  227.             $Products $this->getBlogProduct();
  228.             $this->BlogProduct = new ArrayCollection();
  229.             foreach ($Products as $Product) {
  230.                 $CopyProduct = clone $Product;
  231.                 $this->addBlogProduct($CopyProduct);
  232.                 $CopyProduct->setBlog($this);
  233.             }
  234.             $Images $this->getBlogImage();
  235.             $this->BlogImage = new ArrayCollection();
  236.             foreach ($Images as $Image) {
  237.                 $CloneImage = clone $Image;
  238.                 $this->addBlogImage($CloneImage);
  239.                 $CloneImage->setBlog($this);
  240.             }
  241.             return $this;
  242.         }
  243.         /**
  244.          * @return int
  245.          */
  246.         public function getId()
  247.         {
  248.             return $this->id;
  249.         }
  250.         /**
  251.          * @return string
  252.          */
  253.         public function getTitle()
  254.         {
  255.             return $this->title;
  256.         }
  257.         /**
  258.          * @param string $title
  259.          *
  260.          * @return Blog;
  261.          */
  262.         public function setTitle($title)
  263.         {
  264.             $this->title $title;
  265.             return $this;
  266.         }
  267.         /**
  268.          * @return boolean
  269.          */
  270.         public function getMembers()
  271.         {
  272.             return $this->members;
  273.         }
  274.         /**
  275.          * @param text $members
  276.          *
  277.          * @return Blog;
  278.          */
  279.         public function setMembers($members)
  280.         {
  281.             $this->members $members;
  282.             return $this;
  283.         }
  284.         /**
  285.          * @return text
  286.          */
  287.         public function getLinkurl()
  288.         {
  289.             return $this->linkurl;
  290.         }
  291.         
  292.         /**
  293.          * @param text $linkurl
  294.          *
  295.          * @return Blog;
  296.          */
  297.         public function setLinkurl($linkurl)
  298.         {
  299.             $this->linkurl $linkurl;
  300.             return $this;
  301.         }
  302.         /**
  303.          * @return string
  304.          */
  305.         public function getSlug()
  306.         {
  307.             return $this->slug;
  308.         }
  309.         /**
  310.          * @param string $slug
  311.          *
  312.          * @return Blog;
  313.          */
  314.         public function setSlug($slug)
  315.         {
  316.             $this->slug $slug;
  317.             return $this;
  318.         }
  319.         /**
  320.          * Add blogCategory.
  321.          *
  322.          * @param \Plugin\CMBlogPro42\Entity\BlogCategory $blogCategory
  323.          *
  324.          * @return Blog
  325.          */
  326.         public function addBlogCategory(\Plugin\CMBlogPro42\Entity\BlogCategory $blogCategory)
  327.         {
  328.             $this->BlogCategories[] = $blogCategory;
  329.             return $this;
  330.         }
  331.         /**
  332.          * Add blogShare.
  333.          *
  334.          * @param \Plugin\CMBlogPro42\Entity\BlogShare $blogShare
  335.          *
  336.          * @return Blog
  337.          */
  338.         public function addBlogShare(\Plugin\CMBlogPro42\Entity\blogShare $blogShare)
  339.         {
  340.             $this->BlogShares[] = $blogShare;
  341.             return $this;
  342.         }
  343.         /**
  344.          * Remove blogCategory.
  345.          *
  346.          * @param \Plugin\CMBlogPro42\Entity\BlogCategory $blogCategory
  347.          *
  348.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  349.          */
  350.         public function removeBlogCategory(\Plugin\CMBlogPro42\Entity\BlogCategory $blogCategory)
  351.         {
  352.             return $this->BlogCategories->removeElement($blogCategory);
  353.         }
  354.         /**
  355.          * Remove blogShare.
  356.          *
  357.          * @param \Plugin\CMBlogPro42\Entity\blogShare $blogShare
  358.          *
  359.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  360.          */
  361.         public function removeBlogShare(\Plugin\CMBlogPro42\Entity\BlogShare $blogShare)
  362.         {
  363.             return $this->BlogShares->removeElement($blogShare);
  364.         }
  365.         /**
  366.          * Get blogCategories.
  367.          *
  368.          * @return \Doctrine\Common\Collections\Collection
  369.          */
  370.         public function getBlogCategories()
  371.         {
  372.             return $this->BlogCategories;
  373.         }
  374.         /**
  375.          * Get blogShares.
  376.          *
  377.          * @return \Doctrine\Common\Collections\Collection
  378.          */
  379.         public function getBlogShares()
  380.         {
  381.             return $this->BlogShares;
  382.         }
  383.         /**
  384.          * Add blogProduct.
  385.          *
  386.          * @param \Plugin\CMBlogPro42\Entity\BlogProduct $blogProduct
  387.          *
  388.          * @return Blog
  389.          */
  390.         public function addBlogProduct(\Plugin\CMBlogPro42\Entity\BlogProduct $blogProduct)
  391.         {
  392.             $this->BlogProduct[] = $blogProduct;
  393.             return $this;
  394.         }
  395.         /**
  396.          * Remove blogProduct.
  397.          *
  398.          * @param \Plugin\CMBlogPro42\Entity\BlogProduct $blogProduct
  399.          *
  400.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  401.          */
  402.         public function removeBlogProduct(\Plugin\CMBlogPro42\Entity\BlogProduct $blogProduct)
  403.         {
  404.             return $this->BlogProduct->removeElement($blogProduct);
  405.         }
  406.         /**
  407.          * Get blogProduct.
  408.          *
  409.          * @return \Doctrine\Common\Collections\Collection
  410.          */
  411.         public function getBlogProduct()
  412.         {
  413.             return $this->BlogProduct;
  414.         }
  415.          /**
  416.          * Add blogImage.
  417.          *
  418.          * @param \Plugin\CMBlogPro42\Entity\BlogImage $blogImage
  419.          *
  420.          * @return Blog
  421.          */
  422.         public function addBlogImage(\Plugin\CMBlogPro42\Entity\BlogImage $blogImage)
  423.         {
  424.             $this->BlogImage[] = $blogImage;
  425.             return $this;
  426.         }
  427.         /**
  428.          * Remove blogImage.
  429.          *
  430.          * @param \Plugin\CMBlogPro42\Entity\BlogImage $blogImage
  431.          *
  432.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  433.          */
  434.         public function removeBlogImage(\Plugin\CMBlogPro42\Entity\BlogImage $blogImage)
  435.         {
  436.             return $this->BlogImage->removeElement($blogImage);
  437.         }
  438.         /**
  439.          * Get blogImage.
  440.          *
  441.          * @return \Doctrine\Common\Collections\Collection
  442.          */
  443.         public function getBlogImage()
  444.         {
  445.             return $this->BlogImage;
  446.         }
  447.         /**
  448.          * @return string
  449.          */
  450.         public function getBody()
  451.         {
  452.             return $this->body;
  453.         }
  454.         /**
  455.          * @param string $body
  456.          *
  457.          * @return Blog;
  458.          */
  459.         public function setBody($body)
  460.         {
  461.             $this->body $body;
  462.             return $this;
  463.         }
  464.         /**
  465.          * @return string
  466.          */
  467.         public function getAuthor()
  468.         {
  469.             return $this->author;
  470.         }
  471.         /**
  472.          * @param string $author
  473.          *
  474.          * @return Blog;
  475.          */
  476.         public function setAuthor($author)
  477.         {
  478.             $this->author $author;
  479.             return $this;
  480.         }
  481.         /**
  482.          * @return string
  483.          */
  484.         public function getDescription()
  485.         {
  486.             return $this->description;
  487.         }
  488.         /**
  489.          * @param string $description
  490.          *
  491.          * @return Blog;
  492.          */
  493.         public function setDescription($description)
  494.         {
  495.             $this->description $description;
  496.             return $this;
  497.         }
  498.         /**
  499.          * @return string
  500.          */
  501.         public function getKeyword()
  502.         {
  503.             return $this->keyword;
  504.         }
  505.         /**
  506.          * @param string $keyword
  507.          *
  508.          * @return Blog;
  509.          */
  510.         public function setKeyword($keyword)
  511.         {
  512.             $this->keyword $keyword;
  513.             return $this;
  514.         }
  515.         /**
  516.          * @return string
  517.          */
  518.         public function getRobot()
  519.         {
  520.             return $this->robot;
  521.         }
  522.         /**
  523.          * @param string $robot
  524.          *
  525.          * @return Blog;
  526.          */
  527.         public function setRobot($robot)
  528.         {
  529.             $this->robot $robot;
  530.             return $this;
  531.         }
  532.         /**
  533.          * @return string
  534.          */
  535.         public function getMetatag()
  536.         {
  537.             return $this->metatag;
  538.         }
  539.         /**
  540.          * @param string $metatag
  541.          *
  542.          * @return Blog;
  543.          */
  544.         public function setMetatag($metatag)
  545.         {
  546.             $this->metatag $metatag;
  547.             return $this;
  548.         }
  549.         /**
  550.          * Set releaseDate.
  551.          *
  552.          * @param \DateTime $releaseDate
  553.          *
  554.          * @return Blog
  555.          */
  556.         public function setReleaseDate($releaseDate)
  557.         {
  558.             $this->release_date $releaseDate;
  559.             return $this;
  560.         }
  561.         /**
  562.          * Get releaseDate.
  563.          *
  564.          * @return \DateTime
  565.          */
  566.         public function getReleaseDate()
  567.         {
  568.             return $this->release_date;
  569.         }
  570.         /**
  571.          * Set createDate.
  572.          *
  573.          * @param \DateTime $createDate
  574.          *
  575.          * @return Blog
  576.          */
  577.         public function setCreateDate($createDate)
  578.         {
  579.             $this->create_date $createDate;
  580.             return $this;
  581.         }
  582.         /**
  583.          * Get createDate.
  584.          *
  585.          * @return \DateTime
  586.          */
  587.         public function getCreateDate()
  588.         {
  589.             return $this->create_date;
  590.         }
  591.         /**
  592.          * Set updateDate.
  593.          *
  594.          * @param \DateTime $updateDate
  595.          *
  596.          * @return Blog
  597.          */
  598.         public function setUpdateDate($updateDate)
  599.         {
  600.             $this->update_date $updateDate;
  601.             return $this;
  602.         }
  603.         /**
  604.          * Get updateDate.
  605.          *
  606.          * @return \DateTime
  607.          */
  608.         public function getUpdateDate()
  609.         {
  610.             return $this->update_date;
  611.         }
  612.         /**
  613.          * Set creator.
  614.          *
  615.          * @param \Eccube\Entity\Member|null $creator
  616.          *
  617.          * @return Blog
  618.          */
  619.         public function setCreator(\Eccube\Entity\Member $creator null)
  620.         {
  621.             $this->Creator $creator;
  622.             return $this;
  623.         }
  624.         /**
  625.          * Get creator.
  626.          *
  627.          * @return \Eccube\Entity\Member|null
  628.          */
  629.         public function getCreator()
  630.         {
  631.             return $this->Creator;
  632.         }
  633.         /**
  634.          * Set status.
  635.          *
  636.          * @param \Plugin\CMBlogPro42\Entity\BlogStatus|null $status
  637.          *
  638.          * @return Blog
  639.          */
  640.         public function setStatus(\Plugin\CMBlogPro42\Entity\BlogStatus $status null)
  641.         {
  642.             $this->Status $status;
  643.             return $this;
  644.         }
  645.         /**
  646.          * Get status.
  647.          *
  648.          * @return \Plugin\CMBlogPro42\Entity\BlogStatus|null
  649.          */
  650.         public function getStatus()
  651.         {
  652.             return $this->Status;
  653.         }
  654.         /**
  655.          * @return string
  656.          */
  657.         public function getTag()
  658.         {
  659.             return $this->tag;
  660.         }
  661.         /**
  662.          * @param string $tag
  663.          *
  664.          * @return Blog;
  665.          */
  666.         public function setTag($tag)
  667.         {
  668.             $this->tag $tag;
  669.             return $this;
  670.         }
  671.         /**
  672.          * Set figCaption.
  673.          *
  674.          * @param \DateTime $figCaption
  675.          *
  676.          * @return Blog
  677.          */
  678.         public function setFigCaption($figCaption)
  679.         {
  680.             $this->fig_caption $figCaption;
  681.             return $this;
  682.         }
  683.         /**
  684.          * Get figCaption.
  685.          *
  686.          * @return string
  687.          */
  688.         public function getFigCaption()
  689.         {
  690.             return $this->fig_caption;
  691.         }
  692.     }
  693. }