Skip to content

Instantly share code, notes, and snippets.

@BerezhniyDmitro
Created August 1, 2018 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BerezhniyDmitro/13a0d83aa4bd46d07cf738b81be23cc9 to your computer and use it in GitHub Desktop.
Save BerezhniyDmitro/13a0d83aa4bd46d07cf738b81be23cc9 to your computer and use it in GitHub Desktop.
<?php
namespace App\Models\Page\ServicePage\Entity;
use App\Models\Page\Page;
use App\Models\Page\Seo;
use App\Models\Page\Sitemap;
use App\Models\Page\Social;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\OneToOne;
/**
* @ORM\Entity
* @ORM\Table(name="pages_new")
*/
class ServicePage extends Page {
/**
* @var int тип страницы Регион\бизнес
*/
const BUSINESS_PAGE_TYPE_ID = 3;
/**
* @var string корневой url страниц
*/
const URL_ROOT_SEGMENT = 'services/';
/**
* @ORM\Id
* @ORM\Column(type="integer", name="id")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", name="title")
*/
protected $title;
/**
* @ORM\Column(type="text", name="short_description")
*/
private $shortDescription;
/**
* @ORM\Column(type="string", name="url")
*/
protected $url;
/**
* @ORM\Column(type="boolean", name="is_visible")
*/
private $isVisible = false;
/**
* @ORM\Column(type="integer", name="page_type_id")
*/
private $type = self::BUSINESS_PAGE_TYPE_ID;
/**
* @OneToOne(targetEntity="ServicePageSitemap", inversedBy="page", cascade={"persist", "remove"})
*/
protected $sitemap;
// /**
// * @OneToOne(targetEntity="ServicePageSeo", mappedBy="page", cascade={"persist", "remove"})
// */
// protected $seo;
//
// /**
// * @OneToOne(targetEntity="ServicePageSocial", mappedBy="page", cascade={"persist", "remove"})
// */
// protected $social;
/**
* @param int $id
*/
public function changeId($id)
{
$this->id = $id;
}
/**
* @param string $title
*/
public function changeTitle($title)
{
$this->title = $title;
}
/**
* @param string $shortDescription
*/
public function changeShortDescription($shortDescription)
{
$this->shortDescription = $shortDescription;
}
/**
* @param string $url
*/
public function changeUrl($url)
{
$this->url = self::URL_ROOT_SEGMENT . $url;
}
/**
* @param boolean $isVisible
*/
public function changeIsVisible($isVisible)
{
$this->isVisible = $isVisible;
}
/**
* Метод конвертирует обьект в массив
*
* @return array
*/
public function convert_to_array()
{
return [];
}
/**
* @param Sitemap $sitemap
*/
public function changeSitemap($sitemap)
{
// $sitemap->changePage($this);
$this->sitemap = $sitemap;
}
// /**
// * @param Seo $seo
// */
// public function changeSeo(Seo $seo)
// {
// $seo->changePage($this);
// $this->seo = $seo;
// }
//
// /**
// * @param Social $social
// */
// public function changeSocial(Social $social)
// {
// $social->changePage($this);
// $this->social = $social;
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment