| Total Complexity | 102 |
| Total Lines | 1305 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like Event often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Event, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 35 | class Event implements Translatable |
||
| 36 | { |
||
| 37 | use TranslateTrait; |
||
| 38 | /** |
||
| 39 | * @var int |
||
| 40 | * |
||
| 41 | * @ORM\Column(type="integer") |
||
| 42 | * @ORM\Id |
||
| 43 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 44 | */ |
||
| 45 | private $id; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @ORM\OneToMany( |
||
| 49 | * targetEntity="Stfalcon\Bundle\EventBundle\Entity\Translation\EventTranslation", |
||
| 50 | * mappedBy="object", |
||
| 51 | * cascade={"persist", "remove"} |
||
| 52 | * ) |
||
| 53 | */ |
||
| 54 | private $translations; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @ORM\ManyToOne(targetEntity="Stfalcon\Bundle\EventBundle\Entity\EventGroup", inversedBy="events") |
||
| 58 | */ |
||
| 59 | private $group; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @var ArrayCollection |
||
| 63 | * |
||
| 64 | * @ORM\ManyToMany(targetEntity="Stfalcon\Bundle\EventBundle\Entity\EventAudience", mappedBy="events") |
||
| 65 | */ |
||
| 66 | private $audiences; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var \DateTime |
||
| 70 | * |
||
| 71 | * @Gedmo\Timestampable(on="update") |
||
| 72 | * |
||
| 73 | * @ORM\Column(type="datetime") |
||
| 74 | */ |
||
| 75 | private $updatedAt; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @var ArrayCollection|EventBlock[] |
||
| 79 | * |
||
| 80 | * @ORM\OneToMany(targetEntity="Stfalcon\Bundle\EventBundle\Entity\EventBlock", |
||
| 81 | * mappedBy="event", cascade={"persist", "remove"}, orphanRemoval=true) |
||
| 82 | * @ORM\OrderBy({"position" = "ASC"}) |
||
| 83 | * |
||
| 84 | * @Assert\Valid() |
||
| 85 | */ |
||
| 86 | private $blocks; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var string |
||
| 90 | * |
||
| 91 | * @ORM\Column(type="string") |
||
| 92 | * |
||
| 93 | * @Assert\NotBlank() |
||
| 94 | * |
||
| 95 | * @Gedmo\Translatable(fallback=true) |
||
| 96 | */ |
||
| 97 | protected $name = ''; |
||
| 98 | |||
| 99 | /** |
||
| 100 | * @var string |
||
| 101 | * |
||
| 102 | * @ORM\Column(type="string") |
||
| 103 | * |
||
| 104 | * @Assert\NotBlank() |
||
| 105 | */ |
||
| 106 | protected $slug; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var string |
||
| 110 | * |
||
| 111 | * @ORM\Column(type="string", nullable=true) |
||
| 112 | * |
||
| 113 | * @Gedmo\Translatable(fallback=true) |
||
| 114 | */ |
||
| 115 | protected $city; |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @var string |
||
| 119 | * |
||
| 120 | * @ORM\Column(type="string", nullable=true) |
||
| 121 | * |
||
| 122 | * @Gedmo\Translatable(fallback=true) |
||
| 123 | */ |
||
| 124 | protected $place; |
||
| 125 | |||
| 126 | /** |
||
| 127 | * @var string |
||
| 128 | * |
||
| 129 | * @Assert\NotBlank() |
||
| 130 | * |
||
| 131 | * @ORM\Column(type="string", nullable=true, options={"default":"d MMMM Y, HH:mm"}) |
||
| 132 | */ |
||
| 133 | protected $dateFormat = 'd MMMM Y, HH:mm'; |
||
| 134 | |||
| 135 | /** |
||
| 136 | * @var \DateTime |
||
| 137 | * |
||
| 138 | * @ORM\Column(type="datetime", nullable=false) |
||
| 139 | */ |
||
| 140 | protected $date; |
||
| 141 | |||
| 142 | /** |
||
| 143 | * @var \DateTime |
||
| 144 | * |
||
| 145 | * @ORM\Column(type="datetime", nullable=true) |
||
| 146 | */ |
||
| 147 | protected $dateEnd; |
||
| 148 | |||
| 149 | /** |
||
| 150 | * @var string |
||
| 151 | * |
||
| 152 | * @ORM\Column(type="text") |
||
| 153 | * |
||
| 154 | * @Gedmo\Translatable(fallback=true) |
||
| 155 | * |
||
| 156 | * @Assert\NotBlank() |
||
| 157 | */ |
||
| 158 | protected $description; |
||
| 159 | |||
| 160 | /** |
||
| 161 | * Краткий текст в слайдере. |
||
| 162 | * |
||
| 163 | * @var string |
||
| 164 | * |
||
| 165 | * @Gedmo\Translatable(fallback=true) |
||
| 166 | * |
||
| 167 | * @ORM\Column(type="text", nullable=true) |
||
| 168 | */ |
||
| 169 | protected $about; |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Wants to visit event users count;. |
||
| 173 | * |
||
| 174 | * @var int |
||
| 175 | * |
||
| 176 | * @ORM\Column(type="integer", nullable=true) |
||
| 177 | */ |
||
| 178 | protected $wantsToVisitCount = 0; |
||
| 179 | |||
| 180 | /** |
||
| 181 | * @var string |
||
| 182 | * |
||
| 183 | * @ORM\Column(type="string") |
||
| 184 | */ |
||
| 185 | protected $logo; |
||
| 186 | |||
| 187 | /** |
||
| 188 | * @var string |
||
| 189 | * |
||
| 190 | * @ORM\Column(type="string", nullable=true) |
||
| 191 | */ |
||
| 192 | protected $smallLogo; |
||
| 193 | |||
| 194 | /** |
||
| 195 | * @var string |
||
| 196 | * |
||
| 197 | * @ORM\Column(type="string", nullable=true) |
||
| 198 | */ |
||
| 199 | protected $background; |
||
| 200 | |||
| 201 | /** |
||
| 202 | * @var bool |
||
| 203 | * |
||
| 204 | * @ORM\Column(type="boolean") |
||
| 205 | */ |
||
| 206 | protected $active = true; |
||
| 207 | /** |
||
| 208 | * @var bool |
||
| 209 | * |
||
| 210 | * @ORM\Column(type="boolean") |
||
| 211 | */ |
||
| 212 | protected $smallEvent = false; |
||
| 213 | /** |
||
| 214 | * @var float |
||
| 215 | * |
||
| 216 | * @ORM\Column(name="cost", type="decimal", precision=10, scale=2, nullable=true) |
||
| 217 | */ |
||
| 218 | protected $cost = 0; |
||
| 219 | |||
| 220 | /** |
||
| 221 | * @ORM\OneToMany(targetEntity="Application\Bundle\DefaultBundle\Entity\TicketCost", |
||
| 222 | * mappedBy="event", cascade={"persist", "remove"}, orphanRemoval=true) |
||
| 223 | */ |
||
| 224 | protected $ticketsCost; |
||
| 225 | /** |
||
| 226 | * @var bool |
||
| 227 | * |
||
| 228 | * @ORM\Column(name="receive_payments", type="boolean") |
||
| 229 | */ |
||
| 230 | protected $receivePayments = false; |
||
| 231 | |||
| 232 | /** |
||
| 233 | * Можно ли применять скидку для постоянных участников. |
||
| 234 | * |
||
| 235 | * @var bool |
||
| 236 | * |
||
| 237 | * @ORM\Column(name="use_discounts", type="boolean") |
||
| 238 | */ |
||
| 239 | protected $useDiscounts = true; |
||
| 240 | |||
| 241 | /** |
||
| 242 | * Background color for event card. |
||
| 243 | * |
||
| 244 | * @Assert\NotBlank() |
||
| 245 | * @Assert\Regex( |
||
| 246 | * pattern="/\#[0-9a-fA-F]{6}$/i", |
||
| 247 | * match=true, |
||
| 248 | * message="не верный формат цвета" |
||
| 249 | * ) |
||
| 250 | * |
||
| 251 | * @ORM\Column(name="background_color", type="string", length=7, options={"default":"#4e4e84"}) |
||
| 252 | */ |
||
| 253 | protected $backgroundColor = '#4e4e84'; |
||
| 254 | |||
| 255 | /** |
||
| 256 | * @var bool |
||
| 257 | * |
||
| 258 | * @ORM\Column(type="boolean", options={"default":false}, nullable=true) |
||
| 259 | */ |
||
| 260 | protected $useCustomBackground = false; |
||
| 261 | |||
| 262 | /** |
||
| 263 | * @var bool |
||
| 264 | * |
||
| 265 | * @ORM\Column(type="boolean", options={"default":false}, nullable=true) |
||
| 266 | */ |
||
| 267 | protected $showLogoWithBackground = false; |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @ORM\OneToMany(targetEntity="EventPage", mappedBy="event") |
||
| 271 | * @ORM\OrderBy({"sortOrder" = "DESC"}) |
||
| 272 | */ |
||
| 273 | protected $pages; |
||
| 274 | |||
| 275 | /** |
||
| 276 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 277 | * |
||
| 278 | * @ORM\ManyToMany(targetEntity="Speaker", mappedBy="events") |
||
| 279 | * @ORM\OrderBy({"sortOrder" = "ASC"}) |
||
| 280 | */ |
||
| 281 | protected $speakers; |
||
| 282 | |||
| 283 | /** |
||
| 284 | * Спикери які знаходяться на розгляді участі в евенті. |
||
| 285 | * |
||
| 286 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 287 | * |
||
| 288 | * @ORM\ManyToMany(targetEntity="Speaker", mappedBy="candidateEvents") |
||
| 289 | * @ORM\OrderBy({"sortOrder" = "ASC"}) |
||
| 290 | */ |
||
| 291 | protected $candidateSpeakers; |
||
| 292 | |||
| 293 | /** |
||
| 294 | * Speakers event . |
||
| 295 | * |
||
| 296 | * @var \Doctrine\Common\Collections\ArrayCollection |
||
| 297 | * |
||
| 298 | * @ORM\ManyToMany(targetEntity="Speaker", mappedBy="committeeEvents") |
||
| 299 | * @ORM\OrderBy({"sortOrder" = "ASC"}) |
||
| 300 | */ |
||
| 301 | protected $committeeSpeakers; |
||
| 302 | |||
| 303 | /** |
||
| 304 | * @ORM\OneToMany(targetEntity="Ticket", mappedBy="event") |
||
| 305 | */ |
||
| 306 | protected $tickets; |
||
| 307 | |||
| 308 | /** |
||
| 309 | * @Assert\File(maxSize="6000000") |
||
| 310 | * @Assert\Image |
||
| 311 | * |
||
| 312 | * @Vich\UploadableField(mapping="event_image", fileNameProperty="logo") |
||
| 313 | */ |
||
| 314 | protected $logoFile; |
||
| 315 | |||
| 316 | /** |
||
| 317 | * @Assert\File(maxSize="6000000") |
||
| 318 | * @Assert\Image |
||
| 319 | * |
||
| 320 | * @Vich\UploadableField(mapping="event_image", fileNameProperty="smallLogo") |
||
| 321 | */ |
||
| 322 | protected $smallLogoFile; |
||
| 323 | |||
| 324 | /** |
||
| 325 | * @Assert\File(maxSize="6000000") |
||
| 326 | * @Assert\Image |
||
| 327 | * |
||
| 328 | * @Vich\UploadableField(mapping="event_image", fileNameProperty="background") |
||
| 329 | */ |
||
| 330 | protected $backgroundFile; |
||
| 331 | |||
| 332 | /** |
||
| 333 | * @var string |
||
| 334 | * |
||
| 335 | * @Gedmo\Translatable(fallback=true) |
||
| 336 | * |
||
| 337 | * @ORM\Column(name="meta_description", type="string", length=255, nullable=true) |
||
| 338 | */ |
||
| 339 | protected $metaDescription; |
||
| 340 | |||
| 341 | /** |
||
| 342 | * @var bool |
||
| 343 | * |
||
| 344 | * @ORM\Column(name="admin_only", type="boolean") |
||
| 345 | */ |
||
| 346 | protected $adminOnly = false; |
||
| 347 | |||
| 348 | /** |
||
| 349 | * @var float |
||
| 350 | * |
||
| 351 | * @ORM\Column(type="decimal", precision=12, scale=6, nullable=true) |
||
| 352 | */ |
||
| 353 | private $lat = null; |
||
| 354 | |||
| 355 | /** |
||
| 356 | * @var float |
||
| 357 | * |
||
| 358 | * @ORM\Column(type="decimal", precision=12, scale=6, nullable=true) |
||
| 359 | */ |
||
| 360 | private $lng = null; |
||
| 361 | |||
| 362 | /** |
||
| 363 | * Constructor. |
||
| 364 | */ |
||
| 365 | public function __construct() |
||
| 366 | { |
||
| 367 | $this->speakers = new ArrayCollection(); |
||
| 368 | $this->candidateSpeakers = new ArrayCollection(); |
||
| 369 | $this->committeeSpeakers = new ArrayCollection(); |
||
| 370 | $this->translations = new ArrayCollection(); |
||
| 371 | $this->ticketsCost = new ArrayCollection(); |
||
| 372 | $this->blocks = new ArrayCollection(); |
||
| 373 | $this->audiences = new ArrayCollection(); |
||
| 374 | } |
||
| 375 | |||
| 376 | /** |
||
| 377 | * @return \DateTime |
||
| 378 | */ |
||
| 379 | public function getUpdatedAt() |
||
| 380 | { |
||
| 381 | return $this->updatedAt; |
||
| 382 | } |
||
| 383 | |||
| 384 | /** |
||
| 385 | * @param \DateTime $updatedAt |
||
| 386 | * |
||
| 387 | * @return $this |
||
| 388 | */ |
||
| 389 | public function setUpdatedAt($updatedAt) |
||
| 390 | { |
||
| 391 | $this->updatedAt = $updatedAt; |
||
| 392 | |||
| 393 | return $this; |
||
| 394 | } |
||
| 395 | |||
| 396 | /** |
||
| 397 | * @return bool |
||
| 398 | */ |
||
| 399 | public function isAdminOnly() |
||
| 400 | { |
||
| 401 | return $this->adminOnly; |
||
| 402 | } |
||
| 403 | |||
| 404 | /** |
||
| 405 | * @param bool $adminOnly |
||
| 406 | * |
||
| 407 | * @return $this |
||
| 408 | */ |
||
| 409 | public function setAdminOnly($adminOnly) |
||
| 410 | { |
||
| 411 | $this->adminOnly = $adminOnly; |
||
| 412 | |||
| 413 | return $this; |
||
| 414 | } |
||
| 415 | |||
| 416 | /** |
||
| 417 | * @return string |
||
| 418 | */ |
||
| 419 | public function getDateFormat() |
||
| 420 | { |
||
| 421 | return $this->dateFormat; |
||
| 422 | } |
||
| 423 | |||
| 424 | /** |
||
| 425 | * @param string $dateFormat |
||
| 426 | * |
||
| 427 | * @return $this |
||
| 428 | */ |
||
| 429 | public function setDateFormat($dateFormat) |
||
| 430 | { |
||
| 431 | $this->dateFormat = $dateFormat; |
||
| 432 | |||
| 433 | return $this; |
||
| 434 | } |
||
| 435 | |||
| 436 | /** |
||
| 437 | * @return string |
||
| 438 | */ |
||
| 439 | public function getMetaDescription() |
||
| 440 | { |
||
| 441 | return $this->metaDescription; |
||
| 442 | } |
||
| 443 | |||
| 444 | /** |
||
| 445 | * @param string $metaDescription |
||
| 446 | * |
||
| 447 | * @return $this |
||
| 448 | */ |
||
| 449 | public function setMetaDescription($metaDescription) |
||
| 450 | { |
||
| 451 | $this->metaDescription = $metaDescription; |
||
| 452 | |||
| 453 | return $this; |
||
| 454 | } |
||
| 455 | |||
| 456 | /** |
||
| 457 | * @return mixed |
||
| 458 | */ |
||
| 459 | public function getTicketsCost() |
||
| 460 | { |
||
| 461 | return $this->ticketsCost; |
||
| 462 | } |
||
| 463 | |||
| 464 | /** |
||
| 465 | * @param mixed $ticketsCost |
||
| 466 | * |
||
| 467 | * @return $this |
||
| 468 | */ |
||
| 469 | public function setTicketsCost($ticketsCost) |
||
| 470 | { |
||
| 471 | $this->ticketsCost = $ticketsCost; |
||
| 472 | |||
| 473 | return $this; |
||
| 474 | } |
||
| 475 | |||
| 476 | /** |
||
| 477 | * @param TicketCost $ticketCost |
||
| 478 | * |
||
| 479 | * @return $this |
||
| 480 | */ |
||
| 481 | public function addTicketsCost($ticketCost) |
||
| 482 | { |
||
| 483 | if (!$this->ticketsCost->contains($ticketCost)) { |
||
| 484 | $this->ticketsCost->add($ticketCost); |
||
| 485 | $ticketCost->setEvent($this); |
||
| 486 | } |
||
| 487 | |||
| 488 | return $this; |
||
| 489 | } |
||
| 490 | |||
| 491 | /** |
||
| 492 | * @param TicketCost $ticketCost |
||
| 493 | * |
||
| 494 | * @return $this |
||
| 495 | */ |
||
| 496 | public function removeTicketsCost($ticketCost) |
||
| 497 | { |
||
| 498 | if ($this->ticketsCost->contains($ticketCost)) { |
||
| 499 | $this->ticketsCost->removeElement($ticketCost); |
||
| 500 | } |
||
| 501 | |||
| 502 | return $this; |
||
| 503 | } |
||
| 504 | |||
| 505 | /** |
||
| 506 | * @return mixed |
||
| 507 | */ |
||
| 508 | public function getWantsToVisitCount() |
||
| 509 | { |
||
| 510 | return $this->wantsToVisitCount; |
||
| 511 | } |
||
| 512 | |||
| 513 | /** |
||
| 514 | * @param mixed $wantsToVisitCount |
||
| 515 | * |
||
| 516 | * @return $this |
||
| 517 | */ |
||
| 518 | public function setWantsToVisitCount($wantsToVisitCount) |
||
| 519 | { |
||
| 520 | $this->wantsToVisitCount = $wantsToVisitCount; |
||
| 521 | |||
| 522 | return $this; |
||
| 523 | } |
||
| 524 | |||
| 525 | /** |
||
| 526 | * @return bool |
||
| 527 | */ |
||
| 528 | public function addWantsToVisitCount() |
||
| 529 | { |
||
| 530 | ++$this->wantsToVisitCount; |
||
| 531 | |||
| 532 | return true; |
||
| 533 | } |
||
| 534 | |||
| 535 | /** |
||
| 536 | * @return bool |
||
| 537 | */ |
||
| 538 | public function subtractWantsToVisitCount() |
||
| 539 | { |
||
| 540 | --$this->wantsToVisitCount; |
||
| 541 | |||
| 542 | return true; |
||
| 543 | } |
||
| 544 | |||
| 545 | /** |
||
| 546 | * Get id. |
||
| 547 | * |
||
| 548 | * @return int |
||
| 549 | */ |
||
| 550 | public function getId() |
||
| 551 | { |
||
| 552 | return $this->id; |
||
| 553 | } |
||
| 554 | |||
| 555 | /** |
||
| 556 | * @return \DateTime |
||
| 557 | */ |
||
| 558 | public function getDateEnd() |
||
| 559 | { |
||
| 560 | return $this->dateEnd; |
||
| 561 | } |
||
| 562 | |||
| 563 | /** |
||
| 564 | * @param \DateTime $dateEnd |
||
| 565 | * |
||
| 566 | * @return $this |
||
| 567 | */ |
||
| 568 | public function setDateEnd($dateEnd) |
||
| 569 | { |
||
| 570 | $this->dateEnd = $dateEnd; |
||
| 571 | |||
| 572 | return $this; |
||
| 573 | } |
||
| 574 | |||
| 575 | /** |
||
| 576 | * Set event name. |
||
| 577 | * |
||
| 578 | * @param string $name |
||
| 579 | * |
||
| 580 | * @return $this |
||
| 581 | */ |
||
| 582 | public function setName($name) |
||
| 583 | { |
||
| 584 | $this->name = $name; |
||
| 585 | |||
| 586 | return $this; |
||
| 587 | } |
||
| 588 | |||
| 589 | /** |
||
| 590 | * Get event name. |
||
| 591 | * |
||
| 592 | * @return string |
||
| 593 | */ |
||
| 594 | public function getName() |
||
| 595 | { |
||
| 596 | return $this->name; |
||
| 597 | } |
||
| 598 | |||
| 599 | /** |
||
| 600 | * Set slug. |
||
| 601 | * |
||
| 602 | * @param string $slug |
||
| 603 | * |
||
| 604 | * @return $this |
||
| 605 | */ |
||
| 606 | public function setSlug($slug) |
||
| 607 | { |
||
| 608 | $this->slug = $slug; |
||
| 609 | |||
| 610 | return $this; |
||
| 611 | } |
||
| 612 | |||
| 613 | /** |
||
| 614 | * Get slug. |
||
| 615 | * |
||
| 616 | * @return string |
||
| 617 | */ |
||
| 618 | public function getSlug() |
||
| 619 | { |
||
| 620 | return $this->slug; |
||
| 621 | } |
||
| 622 | |||
| 623 | /** |
||
| 624 | * Set city in which the conference takes place. |
||
| 625 | * |
||
| 626 | * @param string|null $city |
||
| 627 | * |
||
| 628 | * @return $this |
||
| 629 | */ |
||
| 630 | public function setCity($city) |
||
| 631 | { |
||
| 632 | $this->city = $city; |
||
| 633 | |||
| 634 | return $this; |
||
| 635 | } |
||
| 636 | |||
| 637 | /** |
||
| 638 | * Get city in which the conference takes place. |
||
| 639 | * |
||
| 640 | * @return string |
||
| 641 | */ |
||
| 642 | public function getCity() |
||
| 643 | { |
||
| 644 | return $this->city; |
||
| 645 | } |
||
| 646 | |||
| 647 | /** |
||
| 648 | * Set place. |
||
| 649 | * |
||
| 650 | * @param string|null $place |
||
| 651 | * |
||
| 652 | * @return $this |
||
| 653 | */ |
||
| 654 | public function setPlace($place) |
||
| 655 | { |
||
| 656 | $this->place = $place; |
||
| 657 | |||
| 658 | return $this; |
||
| 659 | } |
||
| 660 | |||
| 661 | /** |
||
| 662 | * Get place. |
||
| 663 | * |
||
| 664 | * @return string |
||
| 665 | */ |
||
| 666 | public function getPlace() |
||
| 667 | { |
||
| 668 | return $this->place; |
||
| 669 | } |
||
| 670 | |||
| 671 | /** |
||
| 672 | * Get date. |
||
| 673 | * |
||
| 674 | * @return \DateTime|null |
||
| 675 | */ |
||
| 676 | public function getDate() |
||
| 677 | { |
||
| 678 | return $this->date; |
||
| 679 | } |
||
| 680 | |||
| 681 | /** |
||
| 682 | * Set date. |
||
| 683 | * |
||
| 684 | * @param \DateTime|null $date |
||
| 685 | * |
||
| 686 | * @return $this |
||
| 687 | */ |
||
| 688 | public function setDate($date) |
||
| 689 | { |
||
| 690 | $this->date = $date; |
||
| 691 | |||
| 692 | return $this; |
||
| 693 | } |
||
| 694 | |||
| 695 | /** |
||
| 696 | * Set description. |
||
| 697 | * |
||
| 698 | * @param string $description |
||
| 699 | * |
||
| 700 | * @return $this |
||
| 701 | */ |
||
| 702 | public function setDescription($description) |
||
| 703 | { |
||
| 704 | $this->description = $description; |
||
| 705 | |||
| 706 | return $this; |
||
| 707 | } |
||
| 708 | |||
| 709 | /** |
||
| 710 | * Get description. |
||
| 711 | * |
||
| 712 | * @return string |
||
| 713 | */ |
||
| 714 | public function getDescription() |
||
| 715 | { |
||
| 716 | return $this->description; |
||
| 717 | } |
||
| 718 | |||
| 719 | /** |
||
| 720 | * Set text about event (for main page of event). |
||
| 721 | * |
||
| 722 | * @param string $about |
||
| 723 | * |
||
| 724 | * @return $this |
||
| 725 | */ |
||
| 726 | public function setAbout($about) |
||
| 727 | { |
||
| 728 | $this->about = $about; |
||
| 729 | |||
| 730 | return $this; |
||
| 731 | } |
||
| 732 | |||
| 733 | /** |
||
| 734 | * Get text about event (for main page of event). |
||
| 735 | * |
||
| 736 | * @return string |
||
| 737 | */ |
||
| 738 | public function getAbout() |
||
| 739 | { |
||
| 740 | return $this->about; |
||
| 741 | } |
||
| 742 | |||
| 743 | /** |
||
| 744 | * Set status of activity. |
||
| 745 | * |
||
| 746 | * @param bool $active |
||
| 747 | * |
||
| 748 | * @return $this |
||
| 749 | */ |
||
| 750 | public function setActive($active) |
||
| 751 | { |
||
| 752 | $this->active = $active; |
||
| 753 | |||
| 754 | return $this; |
||
| 755 | } |
||
| 756 | |||
| 757 | /** |
||
| 758 | * Is this event active? |
||
| 759 | * |
||
| 760 | * @return bool |
||
| 761 | */ |
||
| 762 | public function isActive() |
||
| 763 | { |
||
| 764 | return $this->active; |
||
| 765 | } |
||
| 766 | |||
| 767 | /** |
||
| 768 | * @return bool |
||
| 769 | * |
||
| 770 | * @throws \Exception |
||
| 771 | */ |
||
| 772 | public function isActiveAndFuture() |
||
| 773 | { |
||
| 774 | $eventEndDate = $this->dateEnd ?: $this->date; |
||
| 775 | $pastDate = (new \DateTime())->sub(new \DateInterval('P1D')); |
||
| 776 | |||
| 777 | return $this->active && $eventEndDate > $pastDate; |
||
| 778 | } |
||
| 779 | |||
| 780 | /** |
||
| 781 | * @param bool $receivePayments |
||
| 782 | * |
||
| 783 | * @return $this |
||
| 784 | */ |
||
| 785 | public function setReceivePayments($receivePayments) |
||
| 786 | { |
||
| 787 | $this->receivePayments = $receivePayments; |
||
| 788 | |||
| 789 | return $this; |
||
| 790 | } |
||
| 791 | |||
| 792 | /** |
||
| 793 | * @return bool |
||
| 794 | */ |
||
| 795 | public function getReceivePayments() |
||
| 796 | { |
||
| 797 | return $this->receivePayments; |
||
| 798 | } |
||
| 799 | |||
| 800 | /** |
||
| 801 | * @return bool |
||
| 802 | */ |
||
| 803 | public function getUseDiscounts() |
||
| 804 | { |
||
| 805 | return $this->useDiscounts; |
||
| 806 | } |
||
| 807 | |||
| 808 | /** |
||
| 809 | * @param bool $useDiscounts |
||
| 810 | * |
||
| 811 | * @return $this |
||
| 812 | */ |
||
| 813 | public function setUseDiscounts($useDiscounts) |
||
| 814 | { |
||
| 815 | $this->useDiscounts = $useDiscounts; |
||
| 816 | |||
| 817 | return $this; |
||
| 818 | } |
||
| 819 | |||
| 820 | /** |
||
| 821 | * Get event speakers. |
||
| 822 | * |
||
| 823 | * @return ArrayCollection |
||
| 824 | */ |
||
| 825 | public function getSpeakers() |
||
| 826 | { |
||
| 827 | return $this->speakers; |
||
| 828 | } |
||
| 829 | |||
| 830 | /** |
||
| 831 | * Get tickets for event. |
||
| 832 | * |
||
| 833 | * @return ArrayCollection |
||
| 834 | */ |
||
| 835 | public function getTickets() |
||
| 836 | { |
||
| 837 | return $this->tickets; |
||
| 838 | } |
||
| 839 | |||
| 840 | /** |
||
| 841 | * Set logo. |
||
| 842 | * |
||
| 843 | * @param string $logo logo |
||
| 844 | * |
||
| 845 | * @return $this |
||
| 846 | */ |
||
| 847 | public function setLogo($logo) |
||
| 848 | { |
||
| 849 | $this->logo = $logo; |
||
| 850 | |||
| 851 | return $this; |
||
| 852 | } |
||
| 853 | |||
| 854 | /** |
||
| 855 | * Set pages. |
||
| 856 | * |
||
| 857 | * @param ArrayCollection $pages |
||
| 858 | * |
||
| 859 | * @return $this |
||
| 860 | */ |
||
| 861 | public function setPages($pages) |
||
| 862 | { |
||
| 863 | $this->pages = $pages; |
||
| 864 | |||
| 865 | return $this; |
||
| 866 | } |
||
| 867 | |||
| 868 | /** |
||
| 869 | * Set speakers. |
||
| 870 | * |
||
| 871 | * @param ArrayCollection $speakers speakers |
||
| 872 | * |
||
| 873 | * @return $this |
||
| 874 | */ |
||
| 875 | public function setSpeakers($speakers) |
||
| 876 | { |
||
| 877 | $this->speakers = $speakers; |
||
| 878 | |||
| 879 | return $this; |
||
| 880 | } |
||
| 881 | |||
| 882 | /** |
||
| 883 | * Set tickets. |
||
| 884 | * |
||
| 885 | * @param mixed $tickets tickets |
||
| 886 | * |
||
| 887 | * @return $this |
||
| 888 | */ |
||
| 889 | public function setTickets($tickets) |
||
| 890 | { |
||
| 891 | $this->tickets = $tickets; |
||
| 892 | |||
| 893 | return $this; |
||
| 894 | } |
||
| 895 | |||
| 896 | /** |
||
| 897 | * Get path to logo. |
||
| 898 | * |
||
| 899 | * @return string |
||
| 900 | */ |
||
| 901 | public function getLogo() |
||
| 902 | { |
||
| 903 | return $this->logo; |
||
| 904 | } |
||
| 905 | |||
| 906 | /** |
||
| 907 | * Get event name if object treated like a string. |
||
| 908 | * |
||
| 909 | * @return string |
||
| 910 | */ |
||
| 911 | public function __toString() |
||
| 914 | } |
||
| 915 | |||
| 916 | /** |
||
| 917 | * Set logoFile. |
||
| 918 | * |
||
| 919 | * @param UploadedFile|null $logoFile |
||
| 920 | * |
||
| 921 | * @return $this |
||
| 922 | */ |
||
| 923 | public function setLogoFile($logoFile) |
||
| 924 | { |
||
| 925 | $this->logoFile = $logoFile; |
||
| 926 | $this->setUpdatedAt(new \DateTime()); |
||
| 927 | |||
| 928 | return $this; |
||
| 929 | } |
||
| 930 | |||
| 931 | /** |
||
| 932 | * Get logoFile. |
||
| 933 | * |
||
| 934 | * @return UploadedFile |
||
| 935 | */ |
||
| 936 | public function getLogoFile() |
||
| 937 | { |
||
| 938 | return $this->logoFile; |
||
| 939 | } |
||
| 940 | |||
| 941 | /** |
||
| 942 | * @return string |
||
| 943 | */ |
||
| 944 | public function getSmallLogo() |
||
| 945 | { |
||
| 946 | return $this->smallLogo; |
||
| 947 | } |
||
| 948 | |||
| 949 | /** |
||
| 950 | * @param string $smallLogo |
||
| 951 | * |
||
| 952 | * @return $this |
||
| 953 | */ |
||
| 954 | public function setSmallLogo($smallLogo) |
||
| 955 | { |
||
| 956 | $this->smallLogo = $smallLogo; |
||
| 957 | |||
| 958 | return $this; |
||
| 959 | } |
||
| 960 | |||
| 961 | /** |
||
| 962 | * @return mixed |
||
| 963 | */ |
||
| 964 | public function getSmallLogoFile() |
||
| 965 | { |
||
| 966 | return $this->smallLogoFile; |
||
| 967 | } |
||
| 968 | |||
| 969 | /** |
||
| 970 | * @param mixed $smallLogoFile |
||
| 971 | * |
||
| 972 | * @return $this |
||
| 973 | */ |
||
| 974 | public function setSmallLogoFile($smallLogoFile) |
||
| 975 | { |
||
| 976 | $this->smallLogoFile = $smallLogoFile; |
||
| 977 | $this->setUpdatedAt(new \DateTime()); |
||
| 978 | |||
| 979 | return $this; |
||
| 980 | } |
||
| 981 | |||
| 982 | /** |
||
| 983 | * @todo remove this method (and try remove property) |
||
| 984 | * Get event pages |
||
| 985 | * |
||
| 986 | * @return ArrayCollection |
||
| 987 | */ |
||
| 988 | public function getPages() |
||
| 989 | { |
||
| 990 | return $this->pages; |
||
| 991 | } |
||
| 992 | |||
| 993 | /** |
||
| 994 | * Set cost. |
||
| 995 | * |
||
| 996 | * @param float $cost |
||
| 997 | * |
||
| 998 | * @return $this |
||
| 999 | */ |
||
| 1000 | public function setCost($cost) |
||
| 1001 | { |
||
| 1002 | $this->cost = $cost; |
||
| 1003 | |||
| 1004 | return $this; |
||
| 1005 | } |
||
| 1006 | |||
| 1007 | /** |
||
| 1008 | * Get cost. |
||
| 1009 | * |
||
| 1010 | * @return float |
||
| 1011 | */ |
||
| 1012 | public function getCost() |
||
| 1013 | { |
||
| 1014 | return $this->cost; |
||
| 1015 | } |
||
| 1016 | |||
| 1017 | /** |
||
| 1018 | * @return mixed |
||
| 1019 | */ |
||
| 1020 | public function getBackgroundColor() |
||
| 1021 | { |
||
| 1022 | return $this->backgroundColor; |
||
| 1023 | } |
||
| 1024 | |||
| 1025 | /** |
||
| 1026 | * @param mixed $backgroundColor |
||
| 1027 | * |
||
| 1028 | * @return $this |
||
| 1029 | */ |
||
| 1030 | public function setBackgroundColor($backgroundColor) |
||
| 1035 | } |
||
| 1036 | |||
| 1037 | /** |
||
| 1038 | * @return ArrayCollection |
||
| 1039 | */ |
||
| 1040 | public function getCandidateSpeakers() |
||
| 1041 | { |
||
| 1042 | return $this->candidateSpeakers; |
||
| 1043 | } |
||
| 1044 | |||
| 1045 | /** |
||
| 1046 | * @param ArrayCollection $candidateSpeakers |
||
| 1047 | * |
||
| 1048 | * @return $this |
||
| 1049 | */ |
||
| 1050 | public function setCandidateSpeakers($candidateSpeakers) |
||
| 1051 | { |
||
| 1052 | $this->candidateSpeakers = $candidateSpeakers; |
||
| 1053 | |||
| 1054 | return $this; |
||
| 1055 | } |
||
| 1056 | |||
| 1057 | /** |
||
| 1058 | * @return ArrayCollection |
||
| 1059 | */ |
||
| 1060 | public function getCommitteeSpeakers() |
||
| 1061 | { |
||
| 1062 | return $this->committeeSpeakers; |
||
| 1063 | } |
||
| 1064 | |||
| 1065 | /** |
||
| 1066 | * @param ArrayCollection $committeeSpeakers |
||
| 1067 | * |
||
| 1068 | * @return $this |
||
| 1069 | */ |
||
| 1070 | public function setCommitteeSpeakers($committeeSpeakers) |
||
| 1071 | { |
||
| 1072 | $this->committeeSpeakers = $committeeSpeakers; |
||
| 1073 | |||
| 1074 | return $this; |
||
| 1075 | } |
||
| 1076 | |||
| 1077 | /** |
||
| 1078 | * @return bool |
||
| 1079 | */ |
||
| 1080 | public function isSmallEvent() |
||
| 1081 | { |
||
| 1082 | return $this->smallEvent; |
||
| 1083 | } |
||
| 1084 | |||
| 1085 | /** |
||
| 1086 | * @param bool $smallEvent |
||
| 1087 | * |
||
| 1088 | * @return $this |
||
| 1089 | */ |
||
| 1090 | public function setSmallEvent($smallEvent) |
||
| 1091 | { |
||
| 1092 | $this->smallEvent = $smallEvent; |
||
| 1093 | |||
| 1094 | return $this; |
||
| 1095 | } |
||
| 1096 | |||
| 1097 | /** |
||
| 1098 | * @return bool |
||
| 1099 | */ |
||
| 1100 | public function isHaveFreeTickets() |
||
| 1101 | { |
||
| 1102 | /** @var TicketCost $cost */ |
||
| 1103 | foreach ($this->ticketsCost as $cost) { |
||
| 1104 | if ($cost->isEnabled() && ($cost->isUnlimited() || $cost->getCount() > $cost->getSoldCount())) { |
||
| 1105 | return true; |
||
| 1106 | } |
||
| 1107 | } |
||
| 1108 | |||
| 1109 | return false; |
||
| 1110 | } |
||
| 1111 | |||
| 1112 | /** |
||
| 1113 | * @return TicketCost|null |
||
| 1114 | */ |
||
| 1115 | public function getBiggestTicketCost() |
||
| 1116 | { |
||
| 1117 | /** @var TicketCost $result */ |
||
| 1118 | $result = null; |
||
| 1119 | /** @var TicketCost $ticketCost */ |
||
| 1120 | foreach ($this->ticketsCost as $ticketCost) { |
||
| 1121 | if (!$result) { |
||
| 1122 | $result = $ticketCost; |
||
| 1123 | } |
||
| 1124 | if ($ticketCost->getAmount() > $result->getAmount()) { |
||
| 1125 | $result = $ticketCost; |
||
| 1126 | } |
||
| 1127 | } |
||
| 1128 | |||
| 1129 | return $result; |
||
| 1130 | } |
||
| 1131 | |||
| 1132 | /** |
||
| 1133 | * @return EventGroup |
||
| 1134 | */ |
||
| 1135 | public function getGroup() |
||
| 1136 | { |
||
| 1137 | return $this->group; |
||
| 1138 | } |
||
| 1139 | |||
| 1140 | /** |
||
| 1141 | * @param EventGroup $group |
||
| 1142 | * |
||
| 1143 | * @return $this |
||
| 1144 | */ |
||
| 1145 | public function setGroup($group) |
||
| 1146 | { |
||
| 1147 | $this->group = $group; |
||
| 1148 | |||
| 1149 | return $this; |
||
| 1150 | } |
||
| 1151 | |||
| 1152 | /** |
||
| 1153 | * @return float |
||
| 1154 | */ |
||
| 1155 | public function getLat() |
||
| 1156 | { |
||
| 1157 | return $this->lat; |
||
| 1158 | } |
||
| 1159 | |||
| 1160 | /** |
||
| 1161 | * @param float $lat |
||
| 1162 | * |
||
| 1163 | * @return $this |
||
| 1164 | */ |
||
| 1165 | public function setLat($lat) |
||
| 1166 | { |
||
| 1167 | $this->lat = $lat; |
||
| 1168 | |||
| 1169 | return $this; |
||
| 1170 | } |
||
| 1171 | |||
| 1172 | /** |
||
| 1173 | * @return float |
||
| 1174 | */ |
||
| 1175 | public function getLng() |
||
| 1176 | { |
||
| 1177 | return $this->lng; |
||
| 1178 | } |
||
| 1179 | |||
| 1180 | /** |
||
| 1181 | * @param float $lng |
||
| 1182 | * |
||
| 1183 | * @return $this |
||
| 1184 | */ |
||
| 1185 | public function setLng($lng) |
||
| 1186 | { |
||
| 1187 | $this->lng = $lng; |
||
| 1188 | |||
| 1189 | return $this; |
||
| 1190 | } |
||
| 1191 | |||
| 1192 | /** |
||
| 1193 | * @return ArrayCollection |
||
| 1194 | */ |
||
| 1195 | public function getAudiences() |
||
| 1196 | { |
||
| 1197 | return $this->audiences; |
||
| 1198 | } |
||
| 1199 | |||
| 1200 | /** |
||
| 1201 | * @param EventAudience[]|ArrayCollection $audiences |
||
| 1202 | * |
||
| 1203 | * @return $this |
||
| 1204 | */ |
||
| 1205 | public function setAudiences($audiences) |
||
| 1206 | { |
||
| 1207 | $this->audiences = $audiences; |
||
| 1208 | |||
| 1209 | return $this; |
||
| 1210 | } |
||
| 1211 | |||
| 1212 | /** |
||
| 1213 | * @return bool |
||
| 1214 | */ |
||
| 1215 | public function isUseCustomBackground() |
||
| 1218 | } |
||
| 1219 | |||
| 1220 | /** |
||
| 1221 | * @param bool $useCustomBackground |
||
| 1222 | * |
||
| 1223 | * @return $this |
||
| 1224 | */ |
||
| 1225 | public function setUseCustomBackground($useCustomBackground) |
||
| 1230 | } |
||
| 1231 | |||
| 1232 | /** |
||
| 1233 | * @return string |
||
| 1234 | */ |
||
| 1235 | public function getBackground() |
||
| 1236 | { |
||
| 1237 | return $this->background; |
||
| 1238 | } |
||
| 1239 | |||
| 1240 | /** |
||
| 1241 | * @param string $background |
||
| 1242 | * |
||
| 1243 | * @return $this |
||
| 1244 | */ |
||
| 1245 | public function setBackground($background) |
||
| 1246 | { |
||
| 1247 | $this->background = $background; |
||
| 1248 | |||
| 1249 | return $this; |
||
| 1250 | } |
||
| 1251 | |||
| 1252 | /** |
||
| 1253 | * @return bool |
||
| 1254 | */ |
||
| 1255 | public function isShowLogoWithBackground() |
||
| 1256 | { |
||
| 1257 | return $this->showLogoWithBackground; |
||
| 1258 | } |
||
| 1259 | |||
| 1260 | /** |
||
| 1261 | * @param bool $showLogoWithBackground |
||
| 1262 | * |
||
| 1263 | * @return $this |
||
| 1264 | */ |
||
| 1265 | public function setShowLogoWithBackground($showLogoWithBackground) |
||
| 1266 | { |
||
| 1267 | $this->showLogoWithBackground = $showLogoWithBackground; |
||
| 1268 | |||
| 1269 | return $this; |
||
| 1270 | } |
||
| 1271 | |||
| 1272 | /** |
||
| 1273 | * @return mixed |
||
| 1274 | */ |
||
| 1275 | public function getBackgroundFile() |
||
| 1276 | { |
||
| 1277 | return $this->backgroundFile; |
||
| 1278 | } |
||
| 1279 | |||
| 1280 | /** |
||
| 1281 | * @param mixed $backgroundFile |
||
| 1282 | * |
||
| 1283 | * @return $this |
||
| 1284 | */ |
||
| 1285 | public function setBackgroundFile($backgroundFile) |
||
| 1286 | { |
||
| 1287 | $this->backgroundFile = $backgroundFile; |
||
| 1288 | $this->setUpdatedAt(new \DateTime()); |
||
| 1289 | |||
| 1290 | return $this; |
||
| 1291 | } |
||
| 1292 | |||
| 1293 | /** |
||
| 1294 | * @return ArrayCollection|EventBlock[] |
||
| 1295 | */ |
||
| 1296 | public function getBlocks() |
||
| 1297 | { |
||
| 1298 | return $this->blocks; |
||
| 1299 | } |
||
| 1300 | |||
| 1301 | /** |
||
| 1302 | * @param ArrayCollection|EventBlock[] $blocks |
||
| 1303 | * |
||
| 1304 | * @return $this |
||
| 1305 | */ |
||
| 1306 | public function setBlocks($blocks) |
||
| 1311 | } |
||
| 1312 | |||
| 1313 | /** |
||
| 1314 | * @param EventBlock $block |
||
| 1315 | * |
||
| 1316 | * @return $this |
||
| 1317 | */ |
||
| 1318 | public function addBlock($block) |
||
| 1319 | { |
||
| 1320 | if (!$this->blocks->contains($block)) { |
||
| 1321 | $this->blocks->add($block); |
||
| 1322 | $block->setEvent($this); |
||
| 1323 | } |
||
| 1324 | |||
| 1325 | return $this; |
||
| 1326 | } |
||
| 1327 | |||
| 1328 | /** |
||
| 1329 | * @param EventBlock $block |
||
| 1330 | * |
||
| 1331 | * @return $this |
||
| 1332 | */ |
||
| 1333 | public function removeBlock($block) |
||
| 1334 | { |
||
| 1335 | if ($this->blocks->contains($block)) { |
||
| 1336 | $this->blocks->removeElement($block); |
||
| 1337 | } |
||
| 1338 | |||
| 1340 | } |
||
| 1341 | } |
||
| 1342 |