<?phpnamespace DcSiteBundle\Entity;use CoreBundle\Entity\Dealer;use Application\Sonata\MediaBundle\Entity\Gallery;use Application\Sonata\MediaBundle\Entity\Media;use CoreBundle\Entity\AccessoriesReview;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;/** * ServiceWork */class ServiceWork{ /** * @var integer */ private $id; /** * @var integer */ private $mileage; /** * @var string */ private $uid_1c; /** * @var Collection */ private $parts; /** * @var Collection */ private $jobs; /** * @var ServiceVariation */ private $variation; /** * @var Dealer */ private $dealer; /** * @var string */ private $articul; /** * @var Collection */ private $work_group_relations; /** * Constructor */ public function __construct() { $this->parts = new ArrayCollection(); $this->jobs = new ArrayCollection(); $this->variations = new ArrayCollection(); $this->content = new ArrayCollection(); $this->content->add((new ServiceWorkContent())->setLanguage('ru')); $this->content->add((new ServiceWorkContent())->setLanguage('ua')); } public function getArticul() { return $this->articul; } public function setArticul($articul) { $this->articul = $articul; return $this; } /** * @return string */ public function __toString() { return (string) $this->getTitle(); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set mileage * * @param integer $mileage * * @return ServiceWork */ public function setMileage($mileage) { $this->mileage = $mileage; return $this; } /** * Get mileage * * @return integer */ public function getMileage() { return $this->mileage; } /** * Set uid1c * * @param string $uid1c * * @return ServiceWork */ public function setUid1c($uid1c) { $this->uid_1c = $uid1c; return $this; } /** * Get uid1c * * @return string */ public function getUid1c() { return $this->uid_1c; } /** * Add part * * @param ServiceWorkPart $part * * @return ServiceWork */ public function addPart(ServiceWorkPart $part) { $this->parts[] = $part; return $this; } /** * Remove part * * @param ServiceWorkPart $part */ public function removePart(ServiceWorkPart $part) { $this->parts->removeElement($part); } /** * Get parts * * @return Collection */ public function getParts() { return $this->parts; } /** * Add job * * @param ServiceWorkJob $job * * @return ServiceWork */ public function addJob(ServiceWorkJob $job) { $this->jobs[] = $job; return $this; } /** * Remove job * * @param ServiceWorkJob $job */ public function removeJob(ServiceWorkJob $job) { $this->jobs->removeElement($job); } /** * Get jobs * * @return Collection */ public function getJobs() { return $this->jobs; } /** * Set variation * * @param ServiceVariation $variation * * @return ServiceWork */ public function setVariation(ServiceVariation $variation = null) { $this->variation = $variation; return $this; } /** * Get variation * * @return ServiceVariation */ public function getVariation() { return $this->variation; } /** * Set dealer * * @param Dealer $dealer * * @return ServiceWork */ public function setDealer(Dealer $dealer = null) { $this->dealer = $dealer; return $this; } /** * Get dealer * * @return Dealer */ public function getDealer() { return $this->dealer; } /** * @var integer */ private $is_regulations; /** * Set isRegulations * * @param integer $isRegulations * * @return ServiceWork */ public function setIsRegulations($isRegulations) { $this->is_regulations = $isRegulations; return $this; } /** * Get isRegulations * * @return integer */ public function getIsRegulations() { return $this->is_regulations; } /** * @var string */ private $title_ru; /** * @var string */ private $title_ua; public function getTitle($locale = 'ua') { return $locale == 'ru' ? $this->getTitleRu() : $this->getTitleUa(); } /** * Set titleRu * * @param string $titleRu * * @return ServiceWork */ public function setTitleRu($titleRu) { $this->title_ru = $titleRu; return $this; } /** * Get titleRu * * @return string */ public function getTitleRu() { return $this->title_ru; } /** * Set titleUa * * @param string $titleUa * * @return ServiceWork */ public function setTitleUa($titleUa) { $this->title_ua = $titleUa; return $this; } /** * Get titleUa * * @return string */ public function getTitleUa() { return $this->title_ua; } /** * @var ServiceWorkGroup */ private $group; /** * Set group * * @param ServiceWorkGroup $group * * @return ServiceWork */ public function setGroup(ServiceWorkGroup $group = null) { $this->group = $group; return $this; } /** * Get group * * @return ServiceWorkGroup */ public function getGroup() { return $this->group; } /** * @var integer */ private $is_post_warranty; /** * Set isPostWarranty * * @param integer $isPostWarranty * * @return ServiceWork */ public function setIsPostWarranty($isPostWarranty) { $this->is_post_warranty = $isPostWarranty; return $this; } /** * Get isPostWarranty * * @return integer */ public function getIsPostWarranty() { return $this->is_post_warranty; } /** * @var integer */ private $position; /** * Set position * * @param integer $position * * @return ServiceWork */ public function setPosition($position) { $this->position = $position; return $this; } /** * Get position * * @return integer */ public function getPosition() { return $this->position; } /** * @var string */ private $title; /** * @var string */ private $url; /** * @var Gallery */ private $gallery; /** * @var Collection */ private $content; /** * @var Collection */ private $categories; /** * Set title * * @param string $title * * @return ServiceWork */ public function setTitle($title) { $this->title = $title; return $this; } /** * Set url * * @param string $url * * @return ServiceWork */ public function setUrl($url) { $this->url = $url; return $this; } /** * Get url * * @return string */ public function getUrl() { return $this->url; } /** * Set gallery * * @param Gallery $gallery * * @return ServiceWork */ public function setGallery(Gallery $gallery = null) { $this->gallery = $gallery; return $this; } /** * Get gallery * * @return Gallery */ public function getGallery() { return $this->gallery; } /** * Add content * * @param ServiceWorkContent $content * * @return ServiceWork */ public function addContent(ServiceWorkContent $content) { $this->content[] = $content; return $this; } /** * Remove content * * @param ServiceWorkContent $content */ public function removeContent(ServiceWorkContent $content) { $this->content->removeElement($content); } /** * Get content * * @return Collection */ public function getContent() { return $this->content; } /** * Add category * * @param ServiceWorkCategory $category * * @return ServiceWork */ public function addCategory(ServiceWorkCategory $category) { $this->categories[] = $category; return $this; } /** * Remove category * * @param ServiceWorkCategory $category */ public function removeCategory(ServiceWorkCategory $category) { $this->categories->removeElement($category); } /** * Get categories * * @return Collection */ public function getCategories() { return $this->categories; } /** * @var Media */ private $image; /** * Set image * * @param Media $image * * @return ServiceWork */ public function setImage(Media $image = null) { $this->image = $image; return $this; } /** * Get image * * @return Media */ public function getImage() { return $this->image; } private function getContentByLocale($locale = 'ru') { if(!$locale) return $this->content->first(); /** @var ServiceWorkContent $content */ foreach ($this->content as $content) { if ($content->getLanguage() === $locale) { return $content; } } return $this->content->first(); } /** * @param null $locale * @return string */ public function getDescription($locale = null) { $content = $this->getContentByLocale($locale); if(!$content) return ''; return $content->getDescription(); } /** * @param null $locale * @return string */ public function getSeoTitle($locale = null) { $content = $this->getContentByLocale($locale); if(!$content) return ''; return $content->getSeoTitle(); } /** * @param null $locale * @return string */ public function getSeoDescription($locale = null) { $content = $this->getContentByLocale($locale); if(!$content) return ''; return $content->getSeoDescription(); } /** * @var Collection */ private $variations; /** * Add variation * * @param ServiceVariation $variation * * @return ServiceWork */ public function addVariation(ServiceVariation $variation) { $this->variations[] = $variation; return $this; } /** * Remove variation * * @param ServiceVariation $variation */ public function removeVariation(ServiceVariation $variation) { $this->variations->removeElement($variation); } /** * Get variations * * @return Collection */ public function getVariations() { return $this->variations; } /** * @var string */ private $image_hash; /** * Set imageHash * * @param string $imageHash * * @return ServiceWork */ public function setImageHash($imageHash) { $this->image_hash = $imageHash; return $this; } /** * Get imageHash * * @return string */ public function getImageHash() { return $this->image_hash; } /** * @var integer */ private $is_accessory; /** * Set isAccessory * * @param integer $isAccessory * * @return ServiceWork */ public function setIsAccessory($isAccessory) { $this->is_accessory = $isAccessory; return $this; } /** * Get isAccessory * * @return integer */ public function getIsAccessory() { return $this->is_accessory; } /** * @var Collection */ private $accessory_works; /** * Add accessoryWork * * @param AccessoryWorkGroup $accessoryWork * * @return ServiceWork */ public function addAccessoryWork(AccessoryWorkGroup $accessoryWork) { $this->accessory_works[] = $accessoryWork; return $this; } /** * Remove accessoryWork * * @param AccessoryWorkGroup $accessoryWork */ public function removeAccessoryWork(AccessoryWorkGroup $accessoryWork) { $this->accessory_works->removeElement($accessoryWork); } /** * Get accessoryWorks * * @return Collection */ public function getAccessoryWorks() { return $this->accessory_works; } /** * @var Collection */ private $review; /** * Add review * * @param AccessoriesReview $review * * @return ServiceWork */ public function addReview(AccessoriesReview $review) { $this->review[] = $review; return $this; } /** * Remove review * * @param AccessoriesReview $review */ public function removeReview(AccessoriesReview $review) { $this->review->removeElement($review); } /** * Get review * * @return Collection */ public function getReview() { return $this->review; } /** * Add workGroupRelation. * * @param WorkGroupRelation $workGroupRelation * * @return ServiceWork */ public function addWorkGroupRelation(WorkGroupRelation $workGroupRelation) { $this->work_group_relations[] = $workGroupRelation; return $this; } /** * Remove workGroupRelation. * * @param WorkGroupRelation $workGroupRelation * * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. */ public function removeWorkGroupRelation(WorkGroupRelation $workGroupRelation) { return $this->work_group_relations->removeElement($workGroupRelation); } /** * Get workGroupRelations. * * @return Collection */ public function getWorkGroupRelations() { return $this->work_group_relations; } /** * @var bool|null */ private $advertise; /** * Set advertise. * * @param bool|null $advertise * * @return ServiceWork */ public function setAdvertise($advertise = null) { $this->advertise = $advertise; return $this; } /** * Get advertise. * * @return bool|null */ public function getAdvertise() { return $this->advertise; }}