src/Entity/Backend/Competicion.php line 41

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Backend;
  3. use App\DBAL\Backend\EnumLivescoringFormula;
  4. use App\DBAL\Backend\EnumLivescoringPolicy;
  5. use App\Util\Util;
  6. use App\Util\UtilStatic;
  7. use App\Web\Competition\Domain\Inscription\StrictHandicap;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use JMS\Serializer\Annotation\Type;
  13. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. // use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
  16. /**
  17. * @ORM\Entity(repositoryClass="App\Repository\Backend\CompeticionRepository")
  18. * @ORM\Table(
  19. * name="Competicion",
  20. * indexes={
  21. * @ORM\Index(name="Competicion_estado_IDX", columns={"estado"}),
  22. * @ORM\Index(name="Competicion_visible_IDX", columns={"visible"}),
  23. * @ORM\Index(name="Competicion_rfc_IDX", columns={"rfc"}),
  24. * @ORM\Index(name="fk_CompeticionFormula1", columns={"Formula_id"}),
  25. * @ORM\Index(name="fk_CompeticionModo1", columns={"Modo_id"}),
  26. * @ORM\Index(name="fk_CompeticionClub1", columns={"Club_id"}),
  27. * @ORM\Index(name="fk_CompeticionCalculo1", columns={"Calculo_id"}),
  28. * @ORM\Index(name="fk_CompeticionClub2", columns={"Organizador_id"}),
  29. * @ORM\Index(name="fk_CompeticionCriterio1", columns={"Criterio_id"}),
  30. * @ORM\Index(name="fk_CompeticionCriterio2", columns={"Criterio2_id"})
  31. * }
  32. * )
  33. * @ORM\HasLifecycleCallbacks
  34. * @Gedmo\SoftDeleteable(fieldName="deleted_at", timeAware=false)
  35. * Soap\Alias("Competicion")
  36. */
  37. class Competicion
  38. {
  39. const DEFAULT_LOWER_HANDICAPS_TO_USE = 8;
  40. public const INSCRIPTION_HANDICAP_ERROR = 'El jugador no cumple los límites de hándicap de inscripción de la competición.';
  41. /**
  42. * @ORM\Id
  43. * @ORM\GeneratedValue(strategy="AUTO")
  44. * @ORM\Column(type="integer", length=8)
  45. * Soap\ComplexType("int",nillable=true)
  46. */
  47. private $id;
  48. /**
  49. * @ORM\Column(type="string", length=8, nullable=true)
  50. * Soap\ComplexType("string")
  51. */
  52. private $codigo;
  53. /**
  54. * @ORM\Column(type="string", length=15, nullable=true)
  55. * Soap\ComplexType("string")
  56. */
  57. private $codigo_contable;
  58. /**
  59. * @ORM\Column(type="string", length=255)
  60. * Soap\ComplexType("string")
  61. */
  62. private $nombre;
  63. /**
  64. * @ORM\Column(type="date")
  65. * Soap\ComplexType("date")
  66. * @Type("DateTime<'Y-m-d\TH:i:s'>")
  67. */
  68. private $fecha;
  69. /**
  70. * @ORM\Column(type="datetime",nullable=true)
  71. * Soap\ComplexType("date", nillable=true)
  72. * @Type("DateTime<'Y-m-d\TH:i:s'>")
  73. */
  74. private $inicio;
  75. /**
  76. * @ORM\Column(type="datetime",nullable=true)
  77. * Soap\ComplexType("date", nillable=true)
  78. * @Type("DateTime<'Y-m-d\TH:i:s'>")
  79. */
  80. private $fin;
  81. /**
  82. * @ORM\Column(type="integer")
  83. * Soap\ComplexType("int")
  84. */
  85. private $plazas;
  86. /**
  87. * @ORM\Column(type="integer")
  88. * Soap\ComplexType("int")
  89. */
  90. private $jugadores;
  91. /**
  92. * @ORM\ManyToOne(targetEntity="Destacada")
  93. * @ORM\JoinColumn(name="destacada", referencedColumnName="id", onDelete="restrict")
  94. *
  95. */
  96. //Soap\ComplexType("int", nillable=true)
  97. private $destacada;
  98. /**
  99. * @ORM\Column(type="text",nullable=true)
  100. * Soap\ComplexType("string", nillable=true)
  101. */
  102. private $observaciones;
  103. /**
  104. * @ORM\Column(type="text",nullable=true)
  105. */
  106. private $observaciones_planificacion;
  107. /**
  108. * @ORM\Column(type="text", nullable=true)
  109. * Soap\ComplexType("string", nillable=true)
  110. */
  111. private $aviso;
  112. /**
  113. * @ORM\Column(type="text",nullable=true)
  114. * Soap\ComplexType("string", nillable=true)
  115. */
  116. private $informacion;
  117. // /**
  118. // * @ORM\Column(type="date")
  119. // * Soap\ComplexType("date")
  120. // */
  121. // private $created_at;
  122. // /**
  123. // * @ORM\Column(type="date")
  124. // * Soap\ComplexType("date")
  125. // */
  126. // private $updated_at;
  127. /**
  128. * @ORM\Column(type="integer", length=8, nullable=true)
  129. * Soap\ComplexType("int", nillable=true)
  130. */
  131. private $rfeg_id;
  132. /**
  133. * @ORM\Column(name="cartel", type="string",nullable=true)
  134. * Soap\ComplexType("string", nillable=true)
  135. */
  136. private $cartel;
  137. /**
  138. * @Assert\File(maxSize="4M", maxSizeMessage = "El fichero es demasiado grande, debe ser menor de 60 mb", mimeTypes={"application/pdf", "image/jpeg"})
  139. */
  140. public $file_cartel;
  141. /**
  142. * @ORM\Column(name="horario", type="string",nullable=true)
  143. * Soap\ComplexType("string", nillable=true)
  144. */
  145. private $horario;
  146. /**
  147. * @Assert\File(maxSize="4M", maxSizeMessage = "El fichero es demasiado grande, debe ser menor de 4 mb", mimeTypes={"application/pdf"})
  148. *
  149. */
  150. public $file_horario;
  151. /**
  152. * @ORM\Column(name="fichero_inscritos", type="string",nullable=true)
  153. * Soap\ComplexType("string", nillable=true)
  154. */
  155. private $fichero_inscritos;
  156. /**
  157. * @Assert\File(maxSize="4M", maxSizeMessage = "El fichero es demasiado grande, debe ser menor de 4 mb", mimeTypes={"application/pdf"})
  158. *
  159. */
  160. public $file_inscritos;
  161. /**
  162. * @ORM\Column(name="fichero_clasificaciones", type="string",nullable=true)
  163. * Soap\ComplexType("string", nillable=true)
  164. */
  165. private $fichero_clasificaciones;
  166. /**
  167. * @Assert\File(maxSize="4M", maxSizeMessage = "El fichero es demasiado grande, debe ser menor de 4 mb", mimeTypes={"application/pdf"})
  168. *
  169. */
  170. public $file_clasificaciones;
  171. /**
  172. * @ORM\Column(name="fichero_localeRulePdf", type="string",nullable=true)
  173. * Soap\ComplexType("string", nillable=true)
  174. */
  175. public $fichero_localeRulePdf;
  176. /**
  177. * @Assert\File(maxSize="4M", maxSizeMessage = "El fichero es demasiado grande, debe ser menor de 4 mb", mimeTypes={"application/pdf"})
  178. *
  179. */
  180. public $file_localeRulePdf;
  181. /**
  182. * @ORM\Column(name="fichero_banner_schedule", type="string",nullable=true)
  183. * Soap\ComplexType("string", nillable=true)
  184. */
  185. public $fichero_banner_schedule;
  186. /**
  187. * @Assert\File(maxSize="4M", maxSizeMessage = "La imagen es demasiado grande, debe ser menor de 4 mb", mimeTypes={"image/png", "image/jpeg", "image/jpg", "image/gif"})
  188. */
  189. public $file_banner_schedule;
  190. /**
  191. * @ORM\Column(name="fichero_reglas", type="string",nullable=true)
  192. * Soap\ComplexType("string", nillable=true)
  193. */
  194. private $fichero_reglas;
  195. /**
  196. * @ORM\Column(name="fichero_varios_nombre", type="string",nullable=true)
  197. * Soap\ComplexType("string", nillable=true)
  198. */
  199. private $fichero_varios_nombre;
  200. /**
  201. * @ORM\Column(name="fichero_varios", type="string",nullable=true)
  202. * Soap\ComplexType("string", nillable=true)
  203. */
  204. private $fichero_varios;
  205. /**
  206. * @Assert\File(maxSize="4M", maxSizeMessage = "El fichero es demasiado grande, debe ser menor de 4 mb", mimeTypes={"application/pdf"})
  207. *
  208. */
  209. public $file_reglas;
  210. /**
  211. * @Assert\File(maxSize="4M", maxSizeMessage = "El fichero es demasiado grande, debe ser menor de 4 mb", mimeTypes={"application/pdf"})
  212. *
  213. */
  214. public $file_varios;
  215. //Ficticios para el manejo de los ficheros
  216. public $temp_reglas;
  217. public $temp_clasificaciones;
  218. public $temp_localeRulePdf;
  219. public $temp_banner_schedule;
  220. public $temp_inscritos;
  221. public $temp_horario;
  222. public $temp_cartel;
  223. public $temp_varios;
  224. /**
  225. * @ORM\Column(type="string", length=255,nullable=true)
  226. * Soap\ComplexType("string", nillable=true)
  227. */
  228. private $circular;
  229. /**
  230. * @ORM\Column(type="string", length=255,nullable=true)
  231. * Soap\ComplexType("string", nillable=true)
  232. */
  233. private $nombre_observaciones;
  234. /**
  235. * @ORM\Column(type="boolean")
  236. * Soap\ComplexType("boolean")
  237. */
  238. // private $facturar_automatico;
  239. /**
  240. * @ORM\Column(type="boolean")
  241. * Soap\ComplexType("boolean")
  242. */
  243. //private $corte_cerrado;
  244. //
  245. //@ORM\Column(type="boolean")
  246. // Soap\ComplexType("boolean")
  247. //
  248. //private $ega_actualizado;
  249. /**
  250. * @ORM\ManyToOne(targetEntity="Formula")
  251. * @ORM\JoinColumn(name="Formula_id", referencedColumnName="id", onDelete="restrict")
  252. * Soap\ComplexType("App\Entity\Backend\Formula", nillable=true)
  253. * @Type("App\Entity\Backend\Formula")
  254. */
  255. private $formula;
  256. /**
  257. * @ORM\ManyToOne(targetEntity="Modo")
  258. * @ORM\JoinColumn(name="Modo_id", referencedColumnName="id", onDelete="restrict")
  259. * Soap\ComplexType("App\Entity\Backend\Modo", nillable=true)
  260. * @Type("App\Entity\Backend\Modo")
  261. */
  262. private $modo;
  263. /**
  264. * @ORM\ManyToOne(targetEntity="Calculo")
  265. * @ORM\JoinColumn(name="Calculo_id", referencedColumnName="id", onDelete="restrict")
  266. * Soap\ComplexType("App\Entity\Backend\Calculo", nillable=true)
  267. * @Type("App\Entity\Backend\Calculo")
  268. */
  269. private $calculo;
  270. /**
  271. * @ORM\ManyToOne(targetEntity="Club")
  272. * @ORM\JoinColumn(name="Club_id", referencedColumnName="id", onDelete="restrict")
  273. * Soap\ComplexType("App\Entity\Backend\Club", nillable=true)
  274. * @Type("App\Entity\Backend\Club")
  275. */
  276. private $club;
  277. /**
  278. * @ORM\ManyToOne(targetEntity="Club")
  279. * @ORM\JoinColumn(name="Organizador_id", referencedColumnName="id", onDelete="restrict")
  280. * Soap\ComplexType("App\Entity\Backend\Club", nillable=true)
  281. * @Type("App\Entity\Backend\Club")
  282. */
  283. private $organizador;
  284. /**
  285. * Soap\ComplexType("App\Entity\Backend\Albaran", nillable=true)
  286. * @Type("App\Entity\Backend\Albaran")
  287. */
  288. private $albaran;
  289. /**
  290. * @ORM\OneToMany(targetEntity="Albaran", mappedBy="competicion")
  291. * @ORM\OrderBy({"numero" = "ASC"})
  292. * */
  293. private $albaranes;
  294. /**
  295. * @ORM\ManyToOne(targetEntity="Criterio")
  296. * @ORM\JoinColumn(name="Criterio_id", referencedColumnName="id", onDelete="restrict")
  297. *
  298. */
  299. // Soap\ComplexType("int", nillable=true)
  300. private $criterio;
  301. /**
  302. * @ORM\ManyToOne(targetEntity="Criterio")
  303. * @ORM\JoinColumn(name="Criterio2_id", referencedColumnName="id", onDelete="restrict")
  304. *
  305. */
  306. // Soap\ComplexType("int", nillable=true)
  307. private $criterio2;
  308. /**
  309. * @ORM\Column(type="string", length=255, nullable=true)
  310. */
  311. private $hash;
  312. /**
  313. * @ORM\ManyToMany(targetEntity="App\Entity\Backend\Comite")
  314. * @ORM\JoinTable(name="Comite_Competicion",
  315. * joinColumns={@ORM\JoinColumn(name="competicion_id", referencedColumnName="id")},
  316. * inverseJoinColumns={@ORM\JoinColumn(name="Comite_id", referencedColumnName="id")}
  317. * )
  318. * @ORM\OrderBy({"cliente" = "ASC", "activo" = "DESC", "nombre" = "ASC"})
  319. */
  320. private $comites;
  321. /**
  322. * @ORM\ManyToMany(targetEntity="\App\Entity\Backend\Circuito",inversedBy="competiciones")
  323. * @ORM\JoinTable(name="Circuito_Competicion")
  324. * )
  325. * @ORM\OrderBy({"cliente" = "ASC", "fecha_inicio" = "ASC", "fecha_fin" = "ASC", "nombre" = "ASC"})
  326. */
  327. private $circuitos;
  328. /** @ORM\Column(type="enumestadocompeticion")
  329. * Soap\ComplexType("string", nillable=true)
  330. * @Type("string")
  331. */
  332. private $estado;
  333. /** @ORM\Column(type="enumestadocorte")
  334. * Soap\ComplexType("string", nillable=true)
  335. * @Type("string")
  336. */
  337. private $estado_corte;
  338. /**
  339. * @var \DateTime $created_at
  340. *
  341. * @Gedmo\Timestampable(on="create")
  342. * @ORM\Column(type="datetime",nullable=true)
  343. * Soap\ComplexType("date")
  344. * @Type("DateTime<'Y-m-d\TH:i:s'>")
  345. */
  346. private $created_at;
  347. /**
  348. * @var \DateTime $updated_at
  349. *
  350. * @Gedmo\Timestampable(on="update")
  351. * @ORM\Column(type="datetime",nullable=true)
  352. * Soap\ComplexType("date")
  353. * @Type("DateTime<'Y-m-d\TH:i:s'>")
  354. */
  355. private $updated_at;
  356. /**
  357. * @ORM\OneToMany(targetEntity="Inscrito", mappedBy="competicion")
  358. * */
  359. private $inscritos;
  360. /**
  361. * @ORM\OneToMany(targetEntity="Categoria", mappedBy="competicion")
  362. * */
  363. private $categorias;
  364. /**
  365. * @ORM\OneToMany(targetEntity="Tarifa", mappedBy="competicion", cascade={"persist", "remove"}, orphanRemoval=true)
  366. * */
  367. private $tarifas;
  368. /**
  369. * @ORM\Column(type="boolean", nullable=true)
  370. */
  371. private $tarifa_reglamento;
  372. /**
  373. * @ORM\OneToMany(targetEntity="Jornada", mappedBy="competicion", cascade={"persist"})
  374. * @ORM\OrderBy({"orden" = "ASC"})
  375. * */
  376. private $jornadas;
  377. /**
  378. * @ORM\Column(type="string", length=255, nullable=true)
  379. */
  380. private $redireccion;
  381. /**
  382. * @ORM\Column(type="boolean", nullable=false)
  383. */
  384. private $wagr = false;
  385. /**
  386. * @ORM\Column(type="boolean", nullable=false)
  387. */
  388. private $sace = false;
  389. /**
  390. * @ORM\Column(type="boolean", nullable=false)
  391. */
  392. private $subvencion_junta = true;
  393. /**
  394. * @ORM\Column(type="string", length=255, nullable=true)
  395. */
  396. private $galeria;
  397. /**
  398. * @ORM\Column(type="text",nullable=true)
  399. * Soap\ComplexType("string", nillable=true)
  400. */
  401. private $informacion_popup;
  402. /**
  403. * @ORM\Column(type="text",nullable=true)
  404. *
  405. */
  406. private $reglas;
  407. /**
  408. * @ORM\Column(type="integer", length=2, nullable=false)
  409. * Soap\ComplexType("int")
  410. */
  411. private $num_competiciones = 0;
  412. /**
  413. * @ORM\Column(type="string", length=6, nullable=true)
  414. * Soap\ComplexType("string", nillable=true)
  415. */
  416. private $tag_color;
  417. /**
  418. * @ORM\ManyToMany(targetEntity="App\Entity\Backend\Club", inversedBy="solicitadas")
  419. * @ORM\JoinTable(name="Club_Aspirante",
  420. * joinColumns={@ORM\JoinColumn(name="competicion_id", referencedColumnName="id")},
  421. * inverseJoinColumns={@ORM\JoinColumn(name="club_id", referencedColumnName="id")}
  422. * )
  423. */
  424. private $aspirantes;
  425. /**
  426. * @ORM\ManyToMany(targetEntity="App\Entity\Backend\Club", inversedBy="preferencias")
  427. * @ORM\JoinTable(name="Club_Preferente",
  428. * joinColumns={@ORM\JoinColumn(name="competicion_id", referencedColumnName="id")},
  429. * inverseJoinColumns={@ORM\JoinColumn(name="club_id", referencedColumnName="id")}
  430. * )
  431. */
  432. private $preferentes;
  433. /**
  434. * @ORM\Column(type="enumestadolivescoring", nullable=true)
  435. *
  436. */
  437. private $show_live_scoring = "club";
  438. /**
  439. * @ORM\Column(type="boolean", nullable=false)
  440. *
  441. */
  442. private $rfc = false;
  443. /**
  444. * @ORM\Column(type="boolean", nullable=false)
  445. */
  446. private $estricto = true;
  447. /**
  448. * @ORM\Column(type="boolean", nullable=false)
  449. */
  450. private $hcp_estricto = false;
  451. /**
  452. * @ORM\Column(type="decimal", length=2, nullable=false, scale=1, options={"default" : 99})
  453. * Soap\ComplexType("float")
  454. */
  455. private $hcp_inscrito_masculino = 99; //26.4;
  456. /**
  457. * @ORM\Column(type="decimal", length=2, nullable=false, scale=1, options={"default" : -10})
  458. * @Type("float")
  459. * Soap\ComplexType("float")
  460. */
  461. private $hcp_inscrito_masculino_min = -10; //
  462. /**
  463. * @ORM\Column(type="decimal", length=2, nullable=false, scale=1, options={"default" : 99})
  464. * @Type("float")
  465. * Soap\ComplexType("float")
  466. */
  467. private $hcp_inscrito_femenino = 99; //36.0;
  468. /**
  469. * @ORM\Column(type="decimal", length=2, nullable=false, scale=1, options={"default" : -10})
  470. * @Type("float")
  471. * Soap\ComplexType("float")
  472. */
  473. private $hcp_inscrito_femenino_min = -10; //El minimo handicap es
  474. /**
  475. * @ORM\Column(type="integer", nullable=true)
  476. * Soap\ComplexType("int", nillable=true)
  477. */
  478. private $hcp_juego_inscripcion_masculino_min;
  479. /**
  480. * @ORM\Column(type="integer", nullable=true)
  481. * Soap\ComplexType("int", nillable=true)
  482. */
  483. private $hcp_juego_inscripcion_masculino_max;
  484. /**
  485. * @ORM\Column(type="integer", nullable=true)
  486. * Soap\ComplexType("int", nillable=true)
  487. */
  488. private $hcp_juego_inscripcion_femenino_min;
  489. /**
  490. * @ORM\Column(type="integer", nullable=true)
  491. * Soap\ComplexType("int", nillable=true)
  492. */
  493. private $hcp_juego_inscripcion_femenino_max;
  494. /**
  495. * @ORM\Column(type="smallint", nullable=false, options={"default" : 70})
  496. * Soap\ComplexType("int")
  497. */
  498. private $hcp_juego_masculino = 70;
  499. /**
  500. * @ORM\Column(type="smallint", nullable=false, options={"default" : 70})
  501. * Soap\ComplexType("int")
  502. */
  503. private $hcp_juego_femenino = 70;
  504. /**
  505. * @ORM\Column(type="smallint", nullable=false, options={"default" : 99})
  506. * Soap\ComplexType("int")
  507. */
  508. private $hcp_juego_pareja = 99;
  509. /**
  510. * @ORM\Column(type="smallint", nullable=false, options={"default" : 999})
  511. * Soap\ComplexType("int")
  512. */
  513. private $hcp_juego_equipo = 999;
  514. /**
  515. * @ORM\Column(type="text", nullable=true)
  516. */
  517. private $premios;
  518. /**
  519. * @ORM\Column(type="boolean", nullable=false)
  520. */
  521. private $arbitrable = false;
  522. /**
  523. * @ORM\Column(type="boolean", nullable=false)
  524. */
  525. private $direccion_torneos = false;
  526. /**
  527. * @ORM\Column(type="boolean", nullable=false)
  528. */
  529. private $asistencia_presidente = false;
  530. /**
  531. * @ORM\Column(type="boolean", nullable=false)
  532. */
  533. private $institucional = false;
  534. /**
  535. * @ORM\Column(type="boolean", nullable=false)
  536. */
  537. private $voluntarios = false;
  538. /**
  539. * @ORM\Column(type="boolean", nullable=false)
  540. */
  541. private $flyer = false;
  542. /**
  543. * @ORM\Column(type="boolean", nullable=false)
  544. */
  545. private $permitir = false;
  546. /**
  547. * @ORM\Column(type="boolean", nullable=false)
  548. *
  549. */
  550. private $social = false;
  551. /**
  552. * @ORM\Column(type="boolean", nullable=false)
  553. *
  554. */
  555. private $visible = true;
  556. /**
  557. * @ORM\Column(type="boolean", nullable=false)
  558. *
  559. */
  560. private $seguimiento = false;
  561. /**
  562. * @ORM\Column(type="boolean", nullable=false)
  563. */
  564. private $popup_inscripcion = false;
  565. /**
  566. * @ORM\Column(type="text", nullable=true)
  567. */
  568. private $popup_inscripcion_texto;
  569. /**
  570. * @ORM\Column(type="boolean", nullable=false)
  571. */
  572. private $mostrar_sorteo = false;
  573. /**
  574. * @ORM\OneToMany(targetEntity="DatoAdicional", mappedBy="competicion", cascade={"persist", "remove"}, orphanRemoval=true)
  575. * */
  576. private $adicionales;
  577. /**
  578. * @ORM\ManyToOne(targetEntity=CompetitionRegistrationForm::class)
  579. * @ORM\JoinColumn(name="registration_form_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  580. */
  581. private $registrationForm;
  582. /**
  583. * @ORM\Column(type="boolean", nullable=false)
  584. */
  585. private $lista_espera = false;
  586. /**
  587. * @ORM\Column(type="enumestadorestringirlicencias", nullable=true)
  588. */
  589. private $restringir_licencia;
  590. /**
  591. * @ORM\Column(type="boolean", nullable=false)
  592. */
  593. private $seleccion_tarifas = false;
  594. /**
  595. * @ORM\Column(type="boolean", nullable=false)
  596. */
  597. private $permitir_extranjeros = false;
  598. /**
  599. * @ORM\Column(type="smallint", nullable=true)
  600. */
  601. private $plazas_manana;
  602. /**
  603. * @ORM\Column(type="smallint", nullable=true)
  604. */
  605. private $plazas_tarde;
  606. /**
  607. * @ORM\Column(type="boolean", nullable=false)
  608. * Soap\ComplexType("boolean")
  609. */
  610. private $tarjeta_electronica = false;
  611. /**
  612. * @ORM\Column(type="boolean", nullable=false)
  613. */
  614. private $auto_assign_marker = false;
  615. /**
  616. * @ORM\Column(type="boolean", nullable=false)
  617. */
  618. private $livescoring_comunidad = false;
  619. /**
  620. * @ORM\Column(type="smallint", nullable=true)
  621. */
  622. private $plazas_lista_espera;
  623. /**
  624. * @var \DateTime|null
  625. *
  626. * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
  627. */
  628. private $deleted_at;
  629. /**
  630. * @ORM\Column(type="string", length=255, nullable=true)
  631. */
  632. private $contacto;
  633. /**
  634. * @ORM\OneToMany(targetEntity="\App\Entity\Gestion\CompeticionRanking", mappedBy="competicion")
  635. *
  636. */
  637. private $rankings;
  638. /**
  639. * @ORM\Column(type="boolean", nullable=false)
  640. */
  641. private $benefico = false;
  642. /**
  643. * @ORM\ManyToMany(targetEntity="App\Entity\Backend\Voucher", inversedBy="competiciones")
  644. * @ORM\JoinTable(name="Voucher_Competicion")
  645. * @ORM\OrderBy({"fechaInicio" = "ASC", "fechaFin" = "ASC"})
  646. */
  647. private $vouchers;
  648. /**
  649. * @ORM\Column(type="string", nullable=true)
  650. */
  651. private $flickr_gallery = null;
  652. /**
  653. * @ORM\Column(name="barra_salida", type="boolean", nullable=false)
  654. */
  655. private $barra_salida = false;
  656. /**
  657. * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  658. */
  659. private $observaciones_frontend = false;
  660. /**
  661. * @ORM\Column(type="boolean", nullable=false)
  662. */
  663. private $mostrar_plazas = true;
  664. /**
  665. * @ORM\Column(type="smallint", nullable=true, options={"default" : 1})
  666. */
  667. private $politica_inicio = 1;
  668. /**
  669. * @ORM\Column(type="smallint", nullable=true, options={"default" : 1})
  670. */
  671. private $politica_entrega = 1;
  672. /**
  673. * @ORM\Column(name="short_url", type="string", length=255, nullable=true)
  674. */
  675. private $short_url;
  676. /**
  677. * @ORM\Column(type="boolean", options={"default" : 0})
  678. */
  679. private $privada = false;
  680. /**
  681. * @ORM\OneToOne(targetEntity=MarcadorRfc::class, mappedBy="competicion", cascade={"persist", "remove"})
  682. */
  683. private $marcadorRfc;
  684. /**
  685. * @ORM\OneToMany(targetEntity=MensajeTorneo::class, mappedBy="competicion")
  686. */
  687. private $mensajeTorneos;
  688. /**
  689. * @ORM\OneToMany(targetEntity="App\Entity\Gestion\Ronda", mappedBy="competicion")
  690. */
  691. private $rondas;
  692. /**
  693. * @ORM\Column(type="string", length=255, nullable=true)
  694. */
  695. private $camera_url;
  696. /**
  697. * @ORM\Column(type="enumtipoconfiguracionmatchplay", nullable=true)
  698. */
  699. private $tipo_configuracion_matchplay;
  700. /**
  701. * @ORM\Column(type="date", nullable=true)
  702. * @Type("DateTime<'Y-m-d'>")
  703. */
  704. private $liquidation_date;
  705. /**
  706. * @ORM\Column(type="date", nullable=true)
  707. * @Type("DateTime<'Y-m-d'>")
  708. */
  709. private $collection_date;
  710. /**
  711. * @ORM\OneToMany(targetEntity=CompetitionSectionHidden::class, mappedBy="competition", orphanRemoval=false)
  712. */
  713. private $competitionSectionHidden;
  714. /**
  715. *
  716. * @ORM\Column(name="livescoring_policy", type="enumlivescoringpolicy", nullable=false)
  717. */
  718. private $livescoring_policy = EnumLivescoringPolicy::PLAYER_RESULTS;
  719. /**
  720. *
  721. * @ORM\Column(name="livescoring_formula", type="enumlivescoringformula", nullable=false)
  722. */
  723. private $livescoring_formula = EnumLivescoringFormula::HANDICAP_SCRATCH;
  724. /**
  725. * @ORM\Column(type="boolean", nullable=false)
  726. * Soap\ComplexType("boolean")
  727. */
  728. private $show_events = false;
  729. /**
  730. * @ORM\Column(type="boolean")
  731. */
  732. private $advanced_hcp_calculation = false;
  733. /**
  734. * @ORM\Column(type="boolean")
  735. */
  736. private $apply_average_hcp = false;
  737. /**
  738. * @ORM\Column(type="smallint", nullable=true)
  739. */
  740. private $lower_handicaps_to_use = self::DEFAULT_LOWER_HANDICAPS_TO_USE;
  741. /**
  742. * @ORM\Column(type="boolean", options={"default"=false})
  743. */
  744. private $use_first_round_date_for_handicap = false;
  745. /**
  746. * @ORM\Column(type="boolean", options={"default"=false})
  747. */
  748. private $use_without_rfc_handicap = false;
  749. /**
  750. * @ORM\Column(type="decimal", precision=5, scale=1, options={"default"=0})
  751. */
  752. private $without_rfc_handicap_difference = 0.0;
  753. /**
  754. * @ORM\Column(type="boolean", nullable=true)
  755. */
  756. private $can_put_ball = null;
  757. /**
  758. * @ORM\Column(type="boolean", nullable=true)
  759. */
  760. private $can_use_meters = null;
  761. /**
  762. * @ORM\Column(type="boolean", nullable=true)
  763. */
  764. private $can_give_advice = null;
  765. /**
  766. * @ORM\Column(type="string", length=250, nullable=true)
  767. */
  768. private $ecard_initial_message = null;
  769. /**
  770. * @ORM\Column(type="boolean", options={"default"=false})
  771. */
  772. private $hole_distance = false;
  773. /**
  774. * @ORM\OneToMany(targetEntity=RfcCompetition::class, mappedBy="competition", orphanRemoval=true)
  775. */
  776. private $rfcCompetitions;
  777. public function __construct()
  778. {
  779. $this->aspirantes = new ArrayCollection();
  780. $this->preferentes = new ArrayCollection();
  781. $this->comites = new ArrayCollection();
  782. $this->jornadas = new ArrayCollection();
  783. $this->albaranes = new ArrayCollection();
  784. $this->rankings = new ArrayCollection();
  785. $this->circuitos = new ArrayCollection();
  786. $this->inscritos = new ArrayCollection();
  787. $this->categorias = new ArrayCollection();
  788. $this->tarifas = new ArrayCollection();
  789. $this->adicionales = new ArrayCollection();
  790. $this->vouchers = new ArrayCollection();
  791. $this->mensajeTorneos = new ArrayCollection();
  792. $this->competitionSectionHidden = new ArrayCollection();
  793. $this->rfcCompetitions = new ArrayCollection();
  794. }
  795. /**
  796. * Get id
  797. *
  798. * @return integer
  799. */
  800. public function getId()
  801. {
  802. return $this->id;
  803. }
  804. /**
  805. * Set id
  806. *
  807. * @param string $id
  808. * @return Competicion
  809. */
  810. public function setId(?int $id)
  811. {
  812. if (!empty($id) && $id !== 'null') {
  813. $this->id = $id;
  814. }
  815. return $this;
  816. }
  817. /**
  818. * Set codigo
  819. *
  820. * @param string $codigo
  821. * @return Competicion
  822. */
  823. public function setCodigo($codigo)
  824. {
  825. $this->codigo = $codigo;
  826. return $this;
  827. }
  828. /**
  829. * Get codigo
  830. *
  831. * @return string
  832. */
  833. public function getCodigo()
  834. {
  835. return $this->codigo;
  836. }
  837. /**
  838. * Set nombre
  839. *
  840. * @param string $nombre
  841. * @return Competicion
  842. */
  843. public function setNombre($nombre)
  844. {
  845. $this->nombre = $nombre;
  846. return $this;
  847. }
  848. /**
  849. * Get nombre
  850. *
  851. * @return string
  852. */
  853. public function getNombre()
  854. {
  855. return $this->nombre;
  856. }
  857. /**
  858. * Set fecha
  859. *
  860. * @param \DateTime $fecha
  861. * @return Competicion
  862. */
  863. public function setFecha($fecha)
  864. {
  865. $this->fecha = $fecha;
  866. return $this;
  867. }
  868. /**
  869. * Get fecha
  870. *
  871. * @return \DateTime
  872. */
  873. public function getFecha()
  874. {
  875. return $this->fecha;
  876. }
  877. /**
  878. * Set inicio
  879. *
  880. * @param \DateTime $inicio
  881. * @return Competicion
  882. */
  883. public function setInicio($inicio)
  884. {
  885. if (empty($inicio))
  886. return $this;
  887. $this->inicio = $inicio;
  888. return $this;
  889. }
  890. /**
  891. * Get inicio
  892. *
  893. * @return \DateTime
  894. */
  895. public function getInicio()
  896. {
  897. $fecha = $this->inicio;
  898. if (!is_null($this->getClub()) && !is_null($this->getClub()->getTimezone())) {
  899. $timezone = new \DateTimeZone($this->getClub()->getTimezone()->getNombre());
  900. if (!is_null($timezone) && !is_null($fecha)) {
  901. $fecha->setTimezone($timezone);
  902. }
  903. }
  904. return $fecha;
  905. }
  906. /**
  907. * Set fin
  908. *
  909. * @param \DateTime $fin
  910. * @return Competicion
  911. */
  912. public function setFin($fin)
  913. {
  914. if (empty($fin))
  915. return $this;
  916. $this->fin = $fin;
  917. return $this;
  918. }
  919. /**
  920. * Get fin
  921. *
  922. * @return \DateTime
  923. */
  924. public function getFin()
  925. {
  926. $fecha = $this->fin;
  927. if (!is_null($this->getClub()) && !is_null($this->getClub()->getTimezone())) {
  928. $timezone = new \DateTimeZone($this->getClub()->getTimezone()->getNombre());
  929. if (!is_null($timezone) && !is_null($fecha)) {
  930. $fecha->setTimezone($timezone);
  931. }
  932. }
  933. return $fecha;
  934. }
  935. /**
  936. * Set plazas
  937. *
  938. * @param integer $plazas
  939. * @return Competicion
  940. */
  941. public function setPlazas($plazas)
  942. {
  943. $this->plazas = $plazas;
  944. return $this;
  945. }
  946. /**
  947. * Get plazas
  948. *
  949. * @return integer
  950. */
  951. public function getPlazas()
  952. {
  953. return $this->plazas;
  954. }
  955. /**
  956. * Set jugadores
  957. *
  958. * @param integer $jugadores
  959. * @return Competicion
  960. */
  961. public function setJugadores($jugadores)
  962. {
  963. $this->jugadores = $jugadores;
  964. return $this;
  965. }
  966. /**
  967. * Get jugadores
  968. *
  969. * @return integer
  970. */
  971. public function getJugadores()
  972. {
  973. return $this->jugadores;
  974. }
  975. /**
  976. * Set estricto
  977. *
  978. * @param boolean $estricto
  979. * @return Competicion
  980. */
  981. public function setEstricto($estricto)
  982. {
  983. $this->estricto = $estricto;
  984. return $this;
  985. }
  986. /**
  987. * Get estricto
  988. *
  989. * @return boolean
  990. */
  991. public function getEstricto()
  992. {
  993. return $this->estricto;
  994. }
  995. /**
  996. * Set observaciones
  997. *
  998. * @param string $observaciones
  999. * @return Competicion
  1000. */
  1001. public function setObservaciones($observaciones)
  1002. {
  1003. $this->observaciones = $observaciones;
  1004. return $this;
  1005. }
  1006. /**
  1007. * Get observaciones
  1008. *
  1009. * @return string
  1010. */
  1011. public function getObservaciones()
  1012. {
  1013. return $this->observaciones;
  1014. }
  1015. /**
  1016. * Set aviso
  1017. *
  1018. * @param string $aviso
  1019. * @return Competicion
  1020. */
  1021. public function setAviso($aviso)
  1022. {
  1023. $this->aviso = $aviso;
  1024. return $this;
  1025. }
  1026. /**
  1027. * Get aviso
  1028. *
  1029. * @return string
  1030. */
  1031. public function getAviso()
  1032. {
  1033. return $this->aviso;
  1034. }
  1035. /**
  1036. * Set created_at
  1037. *
  1038. * @param \DateTime $createdAt
  1039. * @return Competicion
  1040. */
  1041. public function setCreatedAt($createdAt)
  1042. {
  1043. $this->created_at = $createdAt;
  1044. return $this;
  1045. }
  1046. /**
  1047. * Get created_at
  1048. *
  1049. * @return \DateTime
  1050. */
  1051. public function getCreatedAt()
  1052. {
  1053. return $this->created_at;
  1054. }
  1055. /**
  1056. * Set updated_at
  1057. *
  1058. * @param \DateTime $updatedAt
  1059. * @return Competicion
  1060. */
  1061. public function setUpdatedAt($updatedAt)
  1062. {
  1063. $this->updated_at = $updatedAt;
  1064. return $this;
  1065. }
  1066. /**
  1067. * Get updated_at
  1068. *
  1069. * @return \DateTime
  1070. */
  1071. public function getUpdatedAt()
  1072. {
  1073. return $this->updated_at;
  1074. }
  1075. /**
  1076. * Set rfeg_id
  1077. *
  1078. * @param integer $rfegId
  1079. * @return Competicion
  1080. */
  1081. public function setRfegId($rfegId)
  1082. {
  1083. $this->rfeg_id = $rfegId;
  1084. return $this;
  1085. }
  1086. /**
  1087. * Get rfeg_id
  1088. *
  1089. * @return integer
  1090. */
  1091. public function getRfegId()
  1092. {
  1093. return $this->rfeg_id;
  1094. }
  1095. /**
  1096. * Set circular
  1097. *
  1098. * @param string $circular
  1099. * @return Competicion
  1100. */
  1101. public function setCircular($circular)
  1102. {
  1103. $this->circular = $circular;
  1104. return $this;
  1105. }
  1106. /**
  1107. * Get circular
  1108. *
  1109. * @return string
  1110. */
  1111. public function getCircular()
  1112. {
  1113. return $this->circular;
  1114. }
  1115. /**
  1116. * Set nombre_observaciones
  1117. *
  1118. * @param string $nombreObservaciones
  1119. * @return Competicion
  1120. */
  1121. public function setNombreObservaciones($nombreObservaciones)
  1122. {
  1123. $this->nombre_observaciones = $nombreObservaciones;
  1124. return $this;
  1125. }
  1126. /**
  1127. * Get nombre_observaciones
  1128. *
  1129. * @return string
  1130. */
  1131. public function getNombreObservaciones()
  1132. {
  1133. return $this->nombre_observaciones;
  1134. }
  1135. /**
  1136. * Set destacada
  1137. *
  1138. * @param \App\Entity\Backend\Destacada $destacada
  1139. * @return Competicion
  1140. */
  1141. public function setDestacada(\App\Entity\Backend\Destacada $destacada = null)
  1142. {
  1143. $this->destacada = $destacada;
  1144. return $this;
  1145. }
  1146. /**
  1147. * Get destacada
  1148. *
  1149. * @return \App\Entity\Backend\Destacada
  1150. */
  1151. public function getDestacada()
  1152. {
  1153. return $this->destacada;
  1154. }
  1155. /**
  1156. * Set formula
  1157. *
  1158. * @param \App\Entity\Backend\Formula $formula
  1159. * @return Competicion
  1160. */
  1161. public function setFormula(\App\Entity\Backend\Formula $formula = null)
  1162. {
  1163. $this->formula = $formula;
  1164. return $this;
  1165. }
  1166. /**
  1167. * Get formula
  1168. *
  1169. * @return \App\Entity\Backend\Formula
  1170. */
  1171. public function getFormula()
  1172. {
  1173. return $this->formula;
  1174. }
  1175. /**
  1176. * Set calculo
  1177. *
  1178. * @param \App\Entity\Backend\Calculo $calculo
  1179. * @return Competicion
  1180. */
  1181. public function setCalculo(\App\Entity\Backend\Calculo $calculo = null)
  1182. {
  1183. $this->calculo = $calculo;
  1184. return $this;
  1185. }
  1186. /**
  1187. * Get calculo
  1188. *
  1189. * @return \App\Entity\Backend\Calculo
  1190. */
  1191. public function getCalculo()
  1192. {
  1193. return $this->calculo;
  1194. }
  1195. /**
  1196. * Set club
  1197. *
  1198. * @param \App\Entity\Backend\Club $club
  1199. * @return Competicion
  1200. */
  1201. public function setClub(\App\Entity\Backend\Club $club = null)
  1202. {
  1203. $this->club = $club;
  1204. return $this;
  1205. }
  1206. /**
  1207. * Get club
  1208. *
  1209. * @return \App\Entity\Backend\Club|null
  1210. */
  1211. public function getClub()
  1212. {
  1213. return $this->club;
  1214. }
  1215. /**
  1216. * Set organizador
  1217. *
  1218. * @param \App\Entity\Backend\Club $organizador
  1219. * @return Competicion
  1220. */
  1221. public function setOrganizador(\App\Entity\Backend\Club $organizador = null)
  1222. {
  1223. $this->organizador = $organizador;
  1224. return $this;
  1225. }
  1226. /**
  1227. * Get organizador
  1228. *
  1229. * @return \App\Entity\Backend\Club|null
  1230. */
  1231. public function getOrganizador()
  1232. {
  1233. return $this->organizador;
  1234. }
  1235. /**
  1236. * Set albaran
  1237. *
  1238. * @param \App\Entity\Backend\Albaran $albaran
  1239. * @return Competicion
  1240. */
  1241. public function setAlbaran(\App\Entity\Backend\Albaran $albaran = null)
  1242. {
  1243. $this->albaran = $albaran;
  1244. return $this;
  1245. }
  1246. /**
  1247. * Get albaran
  1248. *
  1249. * @return \App\Entity\Backend\Albaran
  1250. */
  1251. public function getAlbaran()
  1252. {
  1253. return $this->albaran;
  1254. }
  1255. /**
  1256. * Set criterio
  1257. *
  1258. * @param \App\Entity\Backend\Criterio $criterio
  1259. * @return Competicion
  1260. */
  1261. public function setCriterio(\App\Entity\Backend\Criterio $criterio = null)
  1262. {
  1263. $this->criterio = $criterio;
  1264. return $this;
  1265. }
  1266. /**
  1267. * Get criterio
  1268. *
  1269. * @return \App\Entity\Backend\Criterio
  1270. */
  1271. public function getCriterio()
  1272. {
  1273. return $this->criterio;
  1274. }
  1275. /**
  1276. *
  1277. * @ORM\PrePersist
  1278. * @ORM\PreUpdate
  1279. */
  1280. public function updatedTimestamps()
  1281. {
  1282. $this->setUpdatedAt(new \DateTime('now'));
  1283. //Is is new
  1284. if ($this->getCreatedAt() == null) {
  1285. $this->setCreatedAt(new \DateTime('now'));
  1286. }
  1287. }
  1288. /**
  1289. * Add comites
  1290. *
  1291. * @param \App\Entity\Backend\Comite $comites
  1292. * @return Competicion
  1293. */
  1294. public function addComite(\App\Entity\Backend\Comite $comites)
  1295. {
  1296. $this->comites[] = $comites;
  1297. return $this;
  1298. }
  1299. /**
  1300. * Remove comites
  1301. *
  1302. * @param \App\Entity\Backend\Comite $comites
  1303. */
  1304. public function removeComite(\App\Entity\Backend\Comite $comites)
  1305. {
  1306. $this->comites->removeElement($comites);
  1307. }
  1308. /**
  1309. * Get comites
  1310. *
  1311. * @return \Doctrine\Common\Collections\Collection
  1312. */
  1313. public function getComites()
  1314. {
  1315. return $this->comites;
  1316. }
  1317. /**
  1318. * Set comites
  1319. *
  1320. * @param \Doctrine\Common\Collections\ArrayCollection $comites
  1321. * @return Competicion
  1322. */
  1323. public function setComites($comites)
  1324. {
  1325. $this->comites = $comites;
  1326. return $this->comites;
  1327. }
  1328. /**
  1329. * Add circuitos
  1330. *
  1331. * @param \App\Entity\Backend\Circuito $circuitos
  1332. * @return Competicion
  1333. */
  1334. public function addCircuito(\App\Entity\Backend\Circuito $circuitos)
  1335. {
  1336. $this->circuitos[] = $circuitos;
  1337. return $this;
  1338. }
  1339. /**
  1340. * Remove circuitos
  1341. *
  1342. * @param \App\Entity\Backend\Circuito $circuitos
  1343. */
  1344. public function removeCircuito(\App\Entity\Backend\Circuito $circuitos)
  1345. {
  1346. $this->circuitos->removeElement($circuitos);
  1347. }
  1348. /**
  1349. * Get circuitos
  1350. *
  1351. * @return \Doctrine\Common\Collections\Collection
  1352. */
  1353. public function getCircuitos()
  1354. {
  1355. return $this->circuitos;
  1356. }
  1357. /**
  1358. * Set circuitos
  1359. *
  1360. * @param \Doctrine\Common\Collections\ArrayCollection $circuitos
  1361. * @return Competicion
  1362. */
  1363. public function setCircuitos($circuitos)
  1364. {
  1365. $this->circuitos = $circuitos;
  1366. return $this->circuitos;
  1367. }
  1368. /**
  1369. * Set estado
  1370. *
  1371. * @param enumestadocompeticion $estado
  1372. * @return Competicion
  1373. */
  1374. public function setEstado($estado)
  1375. {
  1376. $this->estado = $estado;
  1377. return $this;
  1378. }
  1379. /**
  1380. * Get estado
  1381. *
  1382. * @return enumestadocompeticion
  1383. */
  1384. public function getEstado()
  1385. {
  1386. return $this->estado;
  1387. }
  1388. /**
  1389. * Set hash
  1390. *
  1391. * @param string $hash
  1392. * @return Competicion
  1393. */
  1394. public function setHash($hash)
  1395. {
  1396. $this->hash = $hash;
  1397. return $this;
  1398. }
  1399. /**
  1400. * Get hash
  1401. *
  1402. * @return string
  1403. */
  1404. public function getHash()
  1405. {
  1406. return $this->hash;
  1407. }
  1408. /**
  1409. * Set estado_corte
  1410. *
  1411. * @param enumestadocorte $estadoCorte
  1412. * @return Competicion
  1413. */
  1414. public function setEstadoCorte($estadoCorte)
  1415. {
  1416. $this->estado_corte = $estadoCorte;
  1417. return $this;
  1418. }
  1419. /**
  1420. * Get estado_corte
  1421. *
  1422. * @return enumestadocorte
  1423. */
  1424. public function getEstadoCorte()
  1425. {
  1426. return $this->estado_corte;
  1427. }
  1428. public function __toString()
  1429. {
  1430. return (string)$this->getNombre() . " - " . $this->getFecha()->format('d/m/Y');
  1431. }
  1432. /**
  1433. * Get jornadas
  1434. *
  1435. */
  1436. public function getJornadas()
  1437. {
  1438. return $this->jornadas;
  1439. }
  1440. /**
  1441. * Set jornadas
  1442. *
  1443. * @param \Doctrine\Common\Collections\ArrayCollection $jornadas
  1444. * @return Competicion
  1445. */
  1446. public function setJornadas($jornadas)
  1447. {
  1448. $this->jornadas = $jornadas;
  1449. return $this->jornadas;
  1450. }
  1451. /**
  1452. * Add jornada
  1453. *
  1454. * @param \App\Entity\Backend\Jornada $jornada
  1455. * @return Competicion
  1456. */
  1457. public function addJornada(\App\Entity\Backend\Jornada $jornada)
  1458. {
  1459. $jornada->getCompeticion($this);
  1460. $this->jornadas->add($jornada);
  1461. return $this;
  1462. }
  1463. /**
  1464. * Delete jornadas
  1465. *
  1466. * @param \App\Entity\Backend\Jornada $jornadas
  1467. * @return Competicion
  1468. */
  1469. public function removeJornada(\App\Entity\Backend\Jornada $jornadas)
  1470. {
  1471. $this->jornadas->removeElement($jornadas);
  1472. return $this;
  1473. }
  1474. /**
  1475. * @param bool $hastaHoy Solo se comprueban las jornadas de hoy para atrás
  1476. * @return bool
  1477. */
  1478. public function getJornadasCompatibles($hastaHoy = true): bool
  1479. {
  1480. // Se recogen todas las modalidades de la competicion
  1481. $modalidades = [];
  1482. $now = new \DateTime('today 23:59:59');
  1483. foreach ($this->jornadas as $jornada) {
  1484. if (($hastaHoy && $jornada->getFecha() <= $now) || !$hastaHoy) {
  1485. $modalidades[] = $jornada->getModalidad()->getId();
  1486. }
  1487. }
  1488. // Son compatibles si todas las modalidades son individual
  1489. $todasIndividual = count(array_filter($modalidades, function ($modalidadId) {
  1490. return $modalidadId === "I";
  1491. })) === count($modalidades);
  1492. if ($todasIndividual) {
  1493. return true;
  1494. }
  1495. $gruposCompatibles = [
  1496. ["C", "F", "G", "H", "P"],
  1497. ["A", "S"]
  1498. ];
  1499. if (empty(array_diff($modalidades, $gruposCompatibles[0])) || empty(array_diff($modalidades, $gruposCompatibles[1]))) {
  1500. return true;
  1501. }
  1502. return false;
  1503. }
  1504. /**
  1505. * Add inscritos
  1506. *
  1507. * @param \App\Entity\Backend\Inscrito $inscritos
  1508. * @return Competicion
  1509. */
  1510. public function addInscrito(\App\Entity\Backend\Inscrito $inscritos)
  1511. {
  1512. $this->inscritos[] = $inscritos;
  1513. return $this;
  1514. }
  1515. /**
  1516. * Remove inscritos
  1517. *
  1518. * @param \App\Entity\Backend\Inscrito $inscritos
  1519. */
  1520. public function removeInscrito(\App\Entity\Backend\Inscrito $inscritos)
  1521. {
  1522. $this->inscritos->removeElement($inscritos);
  1523. }
  1524. /**
  1525. * Get inscritos
  1526. *
  1527. * @return \Doctrine\Common\Collections\Collection
  1528. */
  1529. public function getInscritos()
  1530. {
  1531. return $this->inscritos;
  1532. }
  1533. /**
  1534. * Add categorias
  1535. *
  1536. * @param \App\Entity\Backend\Categoria $categorias
  1537. * @return Competicion
  1538. */
  1539. public function addCategoria(\App\Entity\Backend\Categoria $categorias)
  1540. {
  1541. $this->categorias[] = $categorias;
  1542. return $this;
  1543. }
  1544. /**
  1545. * Remove categorias
  1546. *
  1547. * @param \App\Entity\Backend\Categoria $categorias
  1548. */
  1549. public function removeCategoria(\App\Entity\Backend\Categoria $categorias)
  1550. {
  1551. $this->categorias->removeElement($categorias);
  1552. }
  1553. /**
  1554. * Get categorias
  1555. *
  1556. * @return \Doctrine\Common\Collections\Collection
  1557. */
  1558. public function getCategorias()
  1559. {
  1560. return $this->categorias;
  1561. }
  1562. /**
  1563. * Add tarifas
  1564. *
  1565. * @param \App\Entity\Backend\Tarifa $tarifa
  1566. * @return Competicion
  1567. */
  1568. public function addTarifa(\App\Entity\Backend\Tarifa $tarifa)
  1569. {
  1570. $tarifa->setCompeticion($this);
  1571. $this->tarifas[] = $tarifa;
  1572. return $this;
  1573. }
  1574. public function ensureDefaultOnlineRate(): void
  1575. {
  1576. if (!$this->isOnline() || !$this->tarifas->isEmpty()) {
  1577. return;
  1578. }
  1579. $rate = new Tarifa();
  1580. $rate->setNombre('Tarifa Única');
  1581. $rate->setImporte(0);
  1582. $this->addTarifa($rate);
  1583. }
  1584. /**
  1585. * Remove tarifas
  1586. *
  1587. * @param \App\Entity\Backend\Tarifa $tarifa
  1588. */
  1589. public function removeTarifa(\App\Entity\Backend\Tarifa $tarifa)
  1590. {
  1591. $this->tarifas->removeElement($tarifa);
  1592. $tarifa->removeCompeticion();
  1593. }
  1594. /**
  1595. * Get tarifa
  1596. *
  1597. * @return array
  1598. */
  1599. public function getTarifas()
  1600. {
  1601. return $this->tarifas;
  1602. }
  1603. /**
  1604. * Set tarifas
  1605. *
  1606. * @param \Doctrine\Common\Collections\ArrayCollection $tarifas
  1607. * @return Competicion
  1608. */
  1609. public function setTarifas($tarifas)
  1610. {
  1611. $this->tarifas = $tarifas;
  1612. return $this;
  1613. }
  1614. /**
  1615. * Set cartel
  1616. *
  1617. * @param string $cartel
  1618. * @return Competicion
  1619. */
  1620. public function setCartel($cartel)
  1621. {
  1622. $this->cartel = $cartel;
  1623. return $this;
  1624. }
  1625. /**
  1626. * Get cartel
  1627. *
  1628. * @return string
  1629. */
  1630. public function getCartel()
  1631. {
  1632. return $this->cartel;
  1633. }
  1634. public function getFileCartel()
  1635. {
  1636. return $this->file_cartel;
  1637. }
  1638. public function getFileHorario()
  1639. {
  1640. return $this->file_horario;
  1641. }
  1642. public function getFileInscritos()
  1643. {
  1644. return $this->file_inscritos;
  1645. }
  1646. public function getFileClasificaciones()
  1647. {
  1648. return $this->file_clasificaciones;
  1649. }
  1650. public function getFileBannerSchedule()
  1651. {
  1652. return $this->file_banner_schedule;
  1653. }
  1654. public function getFileLocaleRulePdf()
  1655. {
  1656. return $this->file_localeRulePdf;
  1657. }
  1658. public function getFileReglas()
  1659. {
  1660. return $this->file_reglas;
  1661. }
  1662. public function getFileVarios()
  1663. {
  1664. return $this->file_varios;
  1665. }
  1666. public function getAbsolutePath($fichero)
  1667. {
  1668. switch ($fichero) {
  1669. case "cartel":
  1670. return null === $this->cartel ? null : $this->getUploadRootDir() . '/' . $this->cartel;
  1671. case "horario":
  1672. return null === $this->horario ? null : $this->getUploadRootDir() . '/' . $this->horario;
  1673. case "fichero_inscritos":
  1674. return null === $this->fichero_inscritos ? null : $this->getUploadRootDir() . '/' . $this->fichero_inscritos;
  1675. case "fichero_clasificaciones":
  1676. return null === $this->fichero_clasificaciones ? null : $this->getUploadRootDir() . '/' . $this->fichero_clasificaciones;
  1677. case "fichero_banner_schedule":
  1678. return null === $this->fichero_banner_schedule ? null : $this->getUploadRootDir("image") . '/' . $this->fichero_banner_schedule;
  1679. case "fichero_localeRulePdf":
  1680. return null === $this->fichero_localeRulePdf ? null : $this->getUploadRootDir() . '/' . $this->fichero_localeRulePdf;
  1681. case "fichero_reglas":
  1682. return null === $this->fichero_reglas ? null : $this->getUploadRootDir() . '/' . $this->fichero_reglas;
  1683. case "fichero_varios":
  1684. return null === $this->fichero_varios ? null : $this->getUploadRootDir() . '/' . $this->fichero_varios;
  1685. }
  1686. }
  1687. public function getWebPath()
  1688. {
  1689. return null === $this->cartel ? null : $this->getUploadDir() . '/' . $this->cartel;
  1690. }
  1691. protected function getUploadRootDir(string $type = "pdf")
  1692. {
  1693. // la ruta absoluta del directorio donde se deben guardar los archivos cargados
  1694. return __DIR__ . '/../../../public/' . $this->getUploadDir($type);
  1695. }
  1696. protected function getUploadDir(string $type = "pdf")
  1697. {
  1698. // se libra del __DIR__ para no desviarse al mostrar `doc/image` en la vista.
  1699. return "uploads/competiciones/$type";
  1700. }
  1701. /**
  1702. * Renames uploaded file
  1703. * @return string
  1704. */
  1705. public function preUpload()
  1706. {
  1707. if (null !== $this->getFileCartel()) {
  1708. // haz cualquier cosa para generar un nombre único
  1709. $this->cartel = abs(crc32(rand() . "_" . uniqid('archC_'))) . '_' . UtilStatic::normaliza($this->getFileCartel()->getClientOriginalName());
  1710. }
  1711. if (null !== $this->getFileHorario()) {
  1712. // haz cualquier cosa para generar un nombre único
  1713. $this->horario = abs(crc32(rand() . "_" . uniqid('archH_'))) . '_' . UtilStatic::normaliza($this->getFileHorario()->getClientOriginalName());
  1714. }
  1715. if (null !== $this->getFileInscritos()) {
  1716. // haz cualquier cosa para generar un nombre único
  1717. $this->fichero_inscritos = abs(crc32(rand() . "_" . uniqid('archI_'))) . '_' . UtilStatic::normaliza($this->getFileInscritos()->getClientOriginalName());
  1718. }
  1719. if (null !== $this->getFileClasificaciones()) {
  1720. // haz cualquier cosa para generar un nombre único
  1721. $this->fichero_clasificaciones = abs(crc32(rand() . "_" . uniqid('archL_'))) . '_' . UtilStatic::normaliza($this->getFileClasificaciones()->getClientOriginalName());
  1722. }
  1723. if (null !== $this->getFileLocaleRulePdf()) {
  1724. // haz cualquier cosa para generar un nombre único
  1725. $this->fichero_localeRulePdf = abs(crc32(rand() . "_" . uniqid('archL_'))) . '_' . UtilStatic::normaliza($this->getFileLocaleRulePdf()->getClientOriginalName());
  1726. }
  1727. if (null !== $this->getFileBannerSchedule()) {
  1728. // haz cualquier cosa para generar un nombre único
  1729. $this->fichero_banner_schedule = abs(crc32(rand() . "_" . uniqid('archL_'))) . '_' . UtilStatic::normaliza($this->getFileBannerSchedule()->getClientOriginalName());
  1730. }
  1731. if (null !== $this->getFileReglas()) {
  1732. // haz cualquier cosa para generar un nombre único
  1733. $this->fichero_reglas = abs(crc32(rand() . "_" . uniqid('archR_'))) . '_' . UtilStatic::normaliza($this->getFileReglas()->getClientOriginalName());
  1734. }
  1735. if (null !== $this->getFileVarios()) {
  1736. // haz cualquier cosa para generar un nombre único
  1737. $this->fichero_varios = abs(crc32(rand() . "_" . uniqid('archV_'))) . '_' . UtilStatic::normaliza($this->getFileVarios()->getClientOriginalName());
  1738. }
  1739. if (!empty($this->inicio) && ($this->inicio->getTimezone()->getName() !== $_ENV['DEFAULT_TIMEZONE'])) {
  1740. $this->inicio->setTimezone(new \DateTimeZone($_ENV['DEFAULT_TIMEZONE']));
  1741. }
  1742. if (!empty($this->fin) && ($this->fin->getTimezone()->getName() !== $_ENV['DEFAULT_TIMEZONE'])) {
  1743. $this->fin->setTimezone(new \DateTimeZone($_ENV['DEFAULT_TIMEZONE']));
  1744. }
  1745. }
  1746. /**
  1747. * @ORM\PostPersist()
  1748. * @ORM\PostUpdate()
  1749. */
  1750. public function upload()
  1751. {
  1752. // TODO revisar si esto hay que quitarlo o que pasa con esto, porque se ha cambiado la implementacion del cartel
  1753. if (!is_null($this->getFileCartel())) {
  1754. // si hay un error al mover el archivo, move() automáticamente
  1755. // envía una excepción. Esta impedirá que la entidad se persista
  1756. // en la base de datos en caso de error
  1757. $this->getFileCartel()->move($this->getUploadRootDir(), $this->cartel);
  1758. // check if we have an old file
  1759. if (isset($this->temp_cartel)) {
  1760. // delete the old file
  1761. $this->unlinkIfExist($this->getUploadRootDir() . '/' . $this->temp_cartel);
  1762. // clear the temp image path
  1763. $this->temp_cartel = null;
  1764. }
  1765. $this->file_cartel = null;
  1766. $pathCartel = $this->getAbsolutePath("cartel");
  1767. if (substr($pathCartel, -3) == "pdf") {
  1768. $im = new \Imagick();
  1769. $im->readimage($pathCartel);
  1770. $im->setiteratorindex(0); //primera pagina
  1771. $im->setImageFormat('png'); //formato
  1772. $im->setcompressionquality(75); //calidad
  1773. $im->scaleImage(100, 100, true);
  1774. $im->writeimage(substr($pathCartel, 0, -3) . "png"); //usamos substring para quitar la extension
  1775. $im->destroy();
  1776. }
  1777. }
  1778. if (!is_null($this->getFileHorario())) {
  1779. // si hay un error al mover el archivo, move() automáticamente
  1780. // envía una excepción. Esta impedirá que la entidad se persista
  1781. // en la base de datos en caso de error
  1782. $this->getFileHorario()->move($this->getUploadRootDir(), $this->horario);
  1783. // check if we have an old file
  1784. if (isset($this->temp_horario)) {
  1785. // delete the old file
  1786. $this->unlinkIfExist($this->getUploadRootDir() . '/' . $this->temp_horario);
  1787. // clear the temp image path
  1788. $this->temp_horario = null;
  1789. }
  1790. $this->file_horario = null;
  1791. }
  1792. if (!is_null($this->getFileInscritos())) {
  1793. // si hay un error al mover el archivo, move() automáticamente
  1794. // envía una excepción. Esta impedirá que la entidad se persista
  1795. // en la base de datos en caso de error
  1796. $this->getFileInscritos()->move($this->getUploadRootDir(), $this->fichero_inscritos);
  1797. // check if we have an old file
  1798. if (isset($this->temp_inscritos)) {
  1799. // delete the old file
  1800. $this->unlinkIfExist($this->getUploadRootDir() . '/' . $this->temp_inscritos);
  1801. // clear the temp image path
  1802. $this->temp_inscritos = null;
  1803. }
  1804. $this->file_inscritos = null;
  1805. }
  1806. if (!is_null($this->getFileClasificaciones())) {
  1807. // si hay un error al mover el archivo, move() automáticamente
  1808. // envía una excepción. Esta impedirá que la entidad se persista
  1809. // en la base de datos en caso de error
  1810. $this->getFileClasificaciones()->move($this->getUploadRootDir(), $this->fichero_clasificaciones);
  1811. // check if we have an old file
  1812. if (isset($this->temp_clasificaciones)) {
  1813. // delete the old file
  1814. $this->unlinkIfExist($this->getUploadRootDir() . '/' . $this->temp_clasificaciones);
  1815. // clear the temp image path
  1816. $this->temp_clasificaciones = null;
  1817. }
  1818. $this->file_clasificaciones = null;
  1819. }
  1820. if (!is_null($this->getFileLocaleRulePdf())) {
  1821. // si hay un error al mover el archivo, move() automáticamente
  1822. // envía una excepción. Esta impedirá que la entidad se persista
  1823. // en la base de datos en caso de error
  1824. $this->getFileLocaleRulePdf()->move($this->getUploadRootDir(), $this->fichero_localeRulePdf);
  1825. // check if we have an old file
  1826. if (isset($this->temp_localeRulePdf)) {
  1827. // delete the old file
  1828. $this->unlinkIfExist($this->getUploadRootDir() . '/' . $this->temp_localeRulePdf);
  1829. // clear the temp image path
  1830. $this->temp_localeRulePdf = null;
  1831. }
  1832. $this->file_localeRulePdf = null;
  1833. }
  1834. if (!is_null($this->getFileBannerSchedule())) {
  1835. // si hay un error al mover el archivo, move() automáticamente
  1836. // envía una excepción. Esta impedirá que la entidad se persista
  1837. // en la base de datos en caso de error
  1838. $this->getFileBannerSchedule()->move($this->getUploadRootDir("image"), $this->fichero_banner_schedule);
  1839. // check if we have an old file
  1840. if (isset($this->temp_banner_schedule)) {
  1841. // delete the old file
  1842. $this->unlinkIfExist($this->getUploadRootDir("image") . '/' . $this->temp_banner_schedule);
  1843. // clear the temp image path
  1844. $this->temp_banner_schedule = null;
  1845. }
  1846. $this->file_banner_schedule = null;
  1847. }
  1848. if (!is_null($this->getFileReglas())) {
  1849. // si hay un error al mover el archivo, move() automáticamente
  1850. // envía una excepción. Esta impedirá que la entidad se persista
  1851. // en la base de datos en caso de error
  1852. $this->getFileReglas()->move($this->getUploadRootDir(), $this->fichero_reglas);
  1853. // check if we have an old file
  1854. if (isset($this->temp_reglas)) {
  1855. // delete the old file
  1856. $this->unlinkIfExist($this->getUploadRootDir() . '/' . $this->temp_reglas);
  1857. // clear the temp image path
  1858. $this->temp_reglas = null;
  1859. }
  1860. $this->file_reglas = null;
  1861. }
  1862. if (!is_null($this->getFileVarios())) {
  1863. // si hay un error al mover el archivo, move() automáticamente
  1864. // envía una excepción. Esta impedirá que la entidad se persista
  1865. // en la base de datos en caso de error
  1866. $this->getFileVarios()->move($this->getUploadRootDir(), $this->fichero_varios);
  1867. // check if we have an old file
  1868. if (isset($this->temp_varios)) {
  1869. // delete the old file
  1870. $this->unlinkIfExist($this->getUploadRootDir() . '/' . $this->temp_varios);
  1871. // clear the temp image path
  1872. $this->temp_varios = null;
  1873. }
  1874. $this->file_varios = null;
  1875. }
  1876. }
  1877. /**
  1878. * Defaults when inserting a user
  1879. * @ORM\PrePersist()
  1880. */
  1881. public function prePersistTasks()
  1882. {
  1883. $this->preUpload();
  1884. }
  1885. /**
  1886. * Defaults when updating a user
  1887. * @ORM\PreUpdate()
  1888. */
  1889. public function preUpdateTasks()
  1890. {
  1891. $this->preUpload();
  1892. }
  1893. /**
  1894. * @ORM\PostRemove()
  1895. */
  1896. public function removeUpload($fichero)
  1897. {
  1898. switch ($fichero) {
  1899. case "cartel":
  1900. if ($file_cartel = $this->getAbsolutePath('cartel')) {
  1901. unlink($file_cartel);
  1902. $this->setCartel(null);
  1903. }
  1904. break;
  1905. case "horario":
  1906. if ($file_horario = $this->getAbsolutePath('horario')) {
  1907. unlink($file_horario);
  1908. $this->setHorario(null);
  1909. }
  1910. break;
  1911. case "fichero_inscritos":
  1912. if ($file_inscritos = $this->getAbsolutePath('fichero_inscritos')) {
  1913. unlink($file_inscritos);
  1914. $this->setFicheroInscritos(null);
  1915. }
  1916. break;
  1917. case "fichero_clasificaciones":
  1918. if ($file_clasificaciones = $this->getAbsolutePath('fichero_clasificaciones')) {
  1919. unlink($file_clasificaciones);
  1920. $this->setFicheroClasificaciones(null);
  1921. }
  1922. break;
  1923. case "fichero_localeRulePdf":
  1924. if ($file_localeRulePdf = $this->getAbsolutePath('fichero_localeRulePdf')) {
  1925. unlink($file_localeRulePdf);
  1926. $this->setFicheroLocaleRulePdf(null);
  1927. }
  1928. break;
  1929. case "fichero_banner_schedule":
  1930. if ($file_banner_schedule = $this->getAbsolutePath('fichero_banner_schedule')) {
  1931. unlink($file_banner_schedule);
  1932. $this->setFicheroBannerSchedule(null);
  1933. }
  1934. break;
  1935. case "fichero_reglas":
  1936. if ($file_reglas = $this->getAbsolutePath('fichero_reglas')) {
  1937. unlink($file_reglas);
  1938. $this->setFicheroReglas(null);
  1939. }
  1940. break;
  1941. case "fichero_varios":
  1942. if ($file_varios = $this->getAbsolutePath('fichero_varios')) {
  1943. unlink($file_varios);
  1944. $this->setFicheroVarios(null);
  1945. }
  1946. break;
  1947. }
  1948. }
  1949. /**
  1950. * Set horario
  1951. *
  1952. * @param string $horario
  1953. * @return Competicion
  1954. */
  1955. public function setHorario($horario)
  1956. {
  1957. $this->horario = $horario;
  1958. return $this;
  1959. }
  1960. /**
  1961. * Get horario
  1962. *
  1963. * @return string
  1964. */
  1965. public function getHorario()
  1966. {
  1967. return $this->horario;
  1968. }
  1969. /**
  1970. * Set fichero_inscritos
  1971. *
  1972. * @param string $ficheroInscritos
  1973. * @return Competicion
  1974. */
  1975. public function setFicheroInscritos($ficheroInscritos)
  1976. {
  1977. $this->fichero_inscritos = $ficheroInscritos;
  1978. return $this;
  1979. }
  1980. /**
  1981. * Get fichero_inscritos
  1982. *
  1983. * @return string
  1984. */
  1985. public function getFicheroInscritos()
  1986. {
  1987. return $this->fichero_inscritos;
  1988. }
  1989. public function setFicheroLocaleRulePdf($ficheroLocaleRulePdf)
  1990. {
  1991. $this->fichero_localeRulePdf = $ficheroLocaleRulePdf;
  1992. return $this;
  1993. }
  1994. public function getFicheroLocaleRulePdf()
  1995. {
  1996. return $this->fichero_localeRulePdf;
  1997. }
  1998. /**
  1999. * Set fichero_clasificaciones
  2000. *
  2001. * @param string $ficheroClasificaciones
  2002. * @return Competicion
  2003. */
  2004. public function setFicheroClasificaciones($ficheroClasificaciones)
  2005. {
  2006. $this->fichero_clasificaciones = $ficheroClasificaciones;
  2007. return $this;
  2008. }
  2009. /**
  2010. * Get fichero_clasificaciones
  2011. *
  2012. * @return string
  2013. */
  2014. public function getFicheroClasificaciones()
  2015. {
  2016. return $this->fichero_clasificaciones;
  2017. }
  2018. public function setFicheroBannerSchedule($ficheroBannerSchedule)
  2019. {
  2020. $this->fichero_banner_schedule = $ficheroBannerSchedule;
  2021. return $this;
  2022. }
  2023. public function getFicheroBannerSchedule()
  2024. {
  2025. return $this->fichero_banner_schedule;
  2026. }
  2027. /**
  2028. * Set fichero_reglas
  2029. *
  2030. * @param string $ficheroReglas
  2031. * @return Competicion
  2032. */
  2033. public function setFicheroReglas($ficheroReglas)
  2034. {
  2035. $this->fichero_reglas = $ficheroReglas;
  2036. return $this;
  2037. }
  2038. /**
  2039. * Get fichero_reglas
  2040. *
  2041. * @return string
  2042. */
  2043. public function getFicheroReglas()
  2044. {
  2045. return $this->fichero_reglas;
  2046. }
  2047. /**
  2048. * Set fichero_varios
  2049. *
  2050. * @param string $ficheroVarios
  2051. * @return Competicion
  2052. */
  2053. public function setFicheroVarios($ficheroVarios)
  2054. {
  2055. $this->fichero_varios = $ficheroVarios;
  2056. return $this;
  2057. }
  2058. /**
  2059. * Get fichero_varios
  2060. *
  2061. * @return string
  2062. */
  2063. public function getFicheroVarios()
  2064. {
  2065. return $this->fichero_varios;
  2066. }
  2067. /**
  2068. * Set informacion
  2069. *
  2070. * @param string $informacion
  2071. * @return Competicion
  2072. */
  2073. public function setInformacion($informacion)
  2074. {
  2075. $this->informacion = $informacion;
  2076. return $this;
  2077. }
  2078. /**
  2079. * Get informacion
  2080. *
  2081. * @return string
  2082. */
  2083. public function getInformacion()
  2084. {
  2085. return $this->informacion;
  2086. }
  2087. /**
  2088. * Set modo
  2089. *
  2090. * @param \App\Entity\Backend\Modo $modo
  2091. * @return Competicion
  2092. */
  2093. public function setModo(\App\Entity\Backend\Modo $modo = null)
  2094. {
  2095. $this->modo = $modo;
  2096. return $this;
  2097. }
  2098. /**
  2099. * Get modo
  2100. *
  2101. * @return \App\Entity\Backend\Modo
  2102. */
  2103. public function getModo()
  2104. {
  2105. return $this->modo;
  2106. }
  2107. /**
  2108. * isOnline
  2109. *
  2110. * @return boolean
  2111. */
  2112. public function isOnline()
  2113. {
  2114. return ($this->modo->getId() == 3);
  2115. }
  2116. /**
  2117. * Set criterio2
  2118. *
  2119. * @param \App\Entity\Backend\Criterio $criterio2
  2120. * @return Competicion
  2121. */
  2122. public function setCriterio2(\App\Entity\Backend\Criterio $criterio2 = null)
  2123. {
  2124. $this->criterio2 = $criterio2;
  2125. return $this;
  2126. }
  2127. /**
  2128. * Get criterio2
  2129. *
  2130. * @return \App\Entity\Backend\Criterio
  2131. */
  2132. public function getCriterio2()
  2133. {
  2134. return $this->criterio2;
  2135. }
  2136. public function toRfegArray(Util $util, UrlGeneratorInterface $router)
  2137. {
  2138. $nombre = str_replace(array("'"), array('"'), $this->getNombre());
  2139. switch ($this->getDestacada()) {
  2140. case "1":
  2141. case "2":
  2142. $C_Competition_CategTorneo = 2;
  2143. break;
  2144. case "3":
  2145. $C_Competition_CategTorneo = 1;
  2146. break;
  2147. default:
  2148. $C_Competition_CategTorneo = 3;
  2149. }
  2150. $rfeg = array(
  2151. "C_Competition_Id" => $this->getRfegId(),
  2152. "C_Competition_Name" => $nombre,
  2153. "C_Competition_SName" => UtilStatic::limitar_cadena($nombre, 50),
  2154. "C_Competition_ClubId" => $this->getClub()->getRfegId(),
  2155. "C_Competition_StartDate" => $this->getFecha()->format("Y-m-d\TH:i:s"),
  2156. "C_Competition_EndDate" => $util->getLastJornada($this->getId())->getFecha()->format("Y-m-d\TH:i:s"),
  2157. "C_Competition_Level" => "Competiciones de Club",
  2158. "C_Competition_GameStyle" => ($this->getFormula() != null) ? $this->getFormula()->getNombre() : "",
  2159. "C_Competition_GameMode" => ($this->getJugadores() > 1) ? "Por Equipo" : "Individual",
  2160. "C_Competition_Category" => "1,2,3,4,5,6,7,8,9,10",
  2161. "C_Competition_Access" => "Abierto",
  2162. "C_Competition_Sex" => "Mixto",
  2163. "C_Competition_Web" => $router->generate('_tournament', array('id' => $this->getId()), true),
  2164. "C_Competition_CategTorneo" => $C_Competition_CategTorneo,
  2165. "C_Competition_FechaDefinitiva" => 1,
  2166. );
  2167. return $rfeg;
  2168. }
  2169. /**
  2170. * Sets file_inscritos.
  2171. *
  2172. * @param UploadedFile $file
  2173. */
  2174. public function setFileInscritos($file)
  2175. {
  2176. $this->file_inscritos = $file;
  2177. // check if we have an old image path
  2178. if (isset($this->fichero_inscritos)) {
  2179. // store the old name to delete after the update
  2180. $this->temp_inscritos = $this->fichero_inscritos;
  2181. $this->fichero_inscritos = null;
  2182. } else {
  2183. $this->fichero_inscritos = '';
  2184. }
  2185. }
  2186. /**
  2187. * Sets file_reglas.
  2188. *
  2189. * @param UploadedFile $file
  2190. */
  2191. public function setFileReglas($file)
  2192. {
  2193. $this->file_reglas = $file;
  2194. // check if we have an old image path
  2195. if (isset($this->fichero_reglas)) {
  2196. // store the old name to delete after the update
  2197. $this->temp_reglas = $this->fichero_reglas;
  2198. $this->fichero_reglas = null;
  2199. } else {
  2200. $this->fichero_reglas = '';
  2201. }
  2202. }
  2203. /**
  2204. * Sets file_varios.
  2205. *
  2206. * @param UploadedFile $file
  2207. */
  2208. public function setFileVarios($file)
  2209. {
  2210. $this->file_varios = $file;
  2211. // check if we have an old image path
  2212. if (isset($this->fichero_varios)) {
  2213. // store the old name to delete after the update
  2214. $this->temp_varios = $this->fichero_varios;
  2215. $this->fichero_varios = null;
  2216. } else {
  2217. $this->fichero_varios = '';
  2218. }
  2219. }
  2220. /**
  2221. * Sets file.
  2222. *
  2223. * @param UploadedFile $file
  2224. */
  2225. public function setFileClasificaciones($file)
  2226. {
  2227. $this->file_clasificaciones = $file;
  2228. // check if we have an old image path
  2229. if (isset($this->fichero_clasificaciones)) {
  2230. // store the old name to delete after the update
  2231. $this->temp_clasificaciones = $this->fichero_clasificaciones;
  2232. $this->fichero_clasificaciones = null;
  2233. } else {
  2234. $this->fichero_clasificaciones = '';
  2235. }
  2236. }
  2237. public function setFileLocaleRulePdf($file)
  2238. {
  2239. $this->file_localeRulePdf = $file;
  2240. // check if we have an old image path
  2241. if (isset($this->fichero_localeRulePdf)) {
  2242. // store the old name to delete after the update
  2243. $this->temp_localeRulePdf = $this->fichero_localeRulePdf;
  2244. $this->fichero_localeRulePdf = null;
  2245. } else {
  2246. $this->fichero_localeRulePdf = '';
  2247. }
  2248. }
  2249. public function setFileBannerSchedule($file)
  2250. {
  2251. $this->file_banner_schedule = $file;
  2252. // check if we have an old image path
  2253. if (isset($this->fichero_banner_schedule)) {
  2254. // store the old name to delete after the update
  2255. $this->temp_banner_schedule = $this->fichero_banner_schedule;
  2256. $this->fichero_banner_schedule = null;
  2257. } else {
  2258. $this->fichero_banner_schedule = '';
  2259. }
  2260. }
  2261. /**
  2262. * Sets file.
  2263. *
  2264. * @param UploadedFile $file
  2265. */
  2266. public function setFileHorario($file)
  2267. {
  2268. $this->file_horario = $file;
  2269. // check if we have an old image path
  2270. if (isset($this->horario)) {
  2271. // store the old name to delete after the update
  2272. $this->temp_horario = $this->horario;
  2273. $this->horario = null;
  2274. } else {
  2275. $this->horario = '';
  2276. }
  2277. }
  2278. /**
  2279. * Sets file.
  2280. *
  2281. * @param UploadedFile $file
  2282. */
  2283. public function setFileCartel($file)
  2284. {
  2285. $this->file_cartel = $file;
  2286. // check if we have an old image path
  2287. if (isset($this->cartel)) {
  2288. // store the old name to delete after the update
  2289. $this->temp_cartel = $this->cartel;
  2290. $this->cartel = null;
  2291. } else {
  2292. $this->cartel = '';
  2293. }
  2294. }
  2295. /**
  2296. * Set tarifa_reglamento
  2297. *
  2298. * @param boolean $tarifaReglamento
  2299. * @return Competicion
  2300. */
  2301. public function setTarifaReglamento($tarifaReglamento)
  2302. {
  2303. $this->tarifa_reglamento = $tarifaReglamento;
  2304. return $this;
  2305. }
  2306. /**
  2307. * Get tarifa_reglamento
  2308. *
  2309. * @return boolean
  2310. */
  2311. public function getTarifaReglamento()
  2312. {
  2313. return $this->tarifa_reglamento;
  2314. }
  2315. /**
  2316. * Set redireccion
  2317. *
  2318. * @param string $redireccion
  2319. * @return Competicion
  2320. */
  2321. public function setRedireccion($redireccion)
  2322. {
  2323. $this->redireccion = $redireccion;
  2324. return $this;
  2325. }
  2326. /**
  2327. * Get redireccion
  2328. *
  2329. * @return string
  2330. */
  2331. public function getRedireccion()
  2332. {
  2333. return $this->redireccion;
  2334. }
  2335. /**
  2336. * Set wagr
  2337. *
  2338. * @param boolean $wagr
  2339. * @return Competicion
  2340. */
  2341. public function setWagr($wagr)
  2342. {
  2343. $this->wagr = $wagr;
  2344. return $this;
  2345. }
  2346. /**
  2347. * Get wagr
  2348. *
  2349. * @return boolean
  2350. */
  2351. public function getWagr()
  2352. {
  2353. return $this->wagr;
  2354. }
  2355. /**
  2356. * Set sace
  2357. *
  2358. * @param boolean $sace
  2359. * @return Competicion
  2360. */
  2361. public function setSace($sace)
  2362. {
  2363. $this->sace = $sace;
  2364. return $this;
  2365. }
  2366. /**
  2367. * Get sace
  2368. *
  2369. * @return boolean
  2370. */
  2371. public function getSace()
  2372. {
  2373. return $this->sace;
  2374. }
  2375. /**
  2376. * Set subvencionJunta
  2377. *
  2378. * @param boolean $subvencionJunta
  2379. * @return Competicion
  2380. */
  2381. public function setSubvencionJunta($subvencionJunta)
  2382. {
  2383. $this->subvencion_junta = $subvencionJunta;
  2384. return $this;
  2385. }
  2386. /**
  2387. * Get subvencionJunta
  2388. *
  2389. * @return boolean
  2390. */
  2391. public function getSubvencionJunta()
  2392. {
  2393. return $this->subvencion_junta;
  2394. }
  2395. /**
  2396. * Set galeria
  2397. *
  2398. * @param string $galeria
  2399. * @return Competicion
  2400. */
  2401. public function setGaleria($galeria)
  2402. {
  2403. $this->galeria = $galeria;
  2404. return $this;
  2405. }
  2406. /**
  2407. * Get galeria
  2408. *
  2409. * @return string
  2410. */
  2411. public function getGaleria()
  2412. {
  2413. return $this->galeria;
  2414. }
  2415. /**
  2416. * Set informacionPopup
  2417. *
  2418. * @param string $informacionPopup
  2419. * @return Competicion
  2420. */
  2421. public function setInformacionPopup($informacionPopup)
  2422. {
  2423. $this->informacion_popup = $informacionPopup;
  2424. return $this;
  2425. }
  2426. /**
  2427. * Get informacionPopup
  2428. *
  2429. * @return string
  2430. */
  2431. public function getInformacionPopup()
  2432. {
  2433. return $this->informacion_popup;
  2434. }
  2435. /**
  2436. * Set num_competiciones
  2437. *
  2438. * @param integer $numCompeticiones
  2439. * @return Competicion
  2440. */
  2441. public function setNumCompeticiones($numCompeticiones)
  2442. {
  2443. $this->num_competiciones = $numCompeticiones;
  2444. return $this;
  2445. }
  2446. /**
  2447. * Get num_competiciones
  2448. *
  2449. * @return integer
  2450. */
  2451. public function getNumCompeticiones()
  2452. {
  2453. return $this->num_competiciones;
  2454. }
  2455. /**
  2456. * Add aspirantes
  2457. *
  2458. * @param \App\Entity\Backend\Club $aspirante
  2459. * @return Competicion
  2460. */
  2461. public function addAspirante(\App\Entity\Backend\Club $aspirante)
  2462. {
  2463. $this->aspirantes[] = $aspirante;
  2464. return $this;
  2465. }
  2466. /**
  2467. * Remove aspirantes
  2468. *
  2469. * @param \App\Entity\Backend\Club $aspirante
  2470. */
  2471. public function removeAspirante(\App\Entity\Backend\Club $aspirante)
  2472. {
  2473. $this->aspirantes->removeElement($aspirante);
  2474. }
  2475. /**
  2476. * Get aspirantes
  2477. *
  2478. * @return \Doctrine\Common\Collections\Collection
  2479. */
  2480. public function getAspirantes()
  2481. {
  2482. return $this->aspirantes;
  2483. }
  2484. /**
  2485. * Set aspirantes
  2486. *
  2487. * @param \Doctrine\Common\Collections\ArrayCollection $aspirantes
  2488. * @return Competicion
  2489. */
  2490. public function setAspirantes($aspirantes)
  2491. {
  2492. $this->aspirantes = $aspirantes;
  2493. return $this->aspirantes;
  2494. }
  2495. /**
  2496. * Add preferentes
  2497. *
  2498. * @param \App\Entity\Backend\Club $preferentes
  2499. * @return Competicion
  2500. */
  2501. public function addPreferente(\App\Entity\Backend\Club $preferentes)
  2502. {
  2503. $this->preferentes[] = $preferentes;
  2504. return $this;
  2505. }
  2506. /**
  2507. * Remove preferentes
  2508. *
  2509. * @param \App\Entity\Backend\Club $preferentes
  2510. */
  2511. public function removePreferente(\App\Entity\Backend\Club $preferentes)
  2512. {
  2513. $this->preferentes->removeElement($preferentes);
  2514. }
  2515. /**
  2516. * Get preferentes
  2517. *
  2518. * @return \Doctrine\Common\Collections\Collection
  2519. */
  2520. public function getPreferentes()
  2521. {
  2522. return $this->preferentes;
  2523. }
  2524. /**
  2525. * Set preferentes
  2526. *
  2527. * @param \Doctrine\Common\Collections\ArrayCollection $preferentes
  2528. * @return Competicion
  2529. */
  2530. public function setPreferentes($preferentes)
  2531. {
  2532. $this->preferentes = $preferentes;
  2533. return $this->preferentes;
  2534. }
  2535. /**
  2536. * Set observacionesPlanificacion
  2537. *
  2538. * @param string $observacionesPlanificacion
  2539. * @return Competicion
  2540. */
  2541. public function setObservacionesPlanificacion($observacionesPlanificacion)
  2542. {
  2543. $this->observaciones_planificacion = $observacionesPlanificacion;
  2544. return $this;
  2545. }
  2546. /**
  2547. * Get observacionesPlanificacion
  2548. *
  2549. * @return string
  2550. */
  2551. public function getObservacionesPlanificacion()
  2552. {
  2553. return $this->observaciones_planificacion;
  2554. }
  2555. /**
  2556. * Set tag_color
  2557. *
  2558. * @param string $tagColor
  2559. * @return Competicion
  2560. */
  2561. public function setTagColor($tagColor)
  2562. {
  2563. $color = strtolower(str_replace("#", "", $tagColor));
  2564. $this->tag_color = (strtolower($color) != "ffffff") ? $color : null;
  2565. return $this;
  2566. }
  2567. /**
  2568. * Get tag_color
  2569. *
  2570. * @return string
  2571. */
  2572. public function getTagColor()
  2573. {
  2574. return ($this->tag_color) ? "#" . $this->tag_color : null;
  2575. }
  2576. /**
  2577. * Set showLiveScoring
  2578. *
  2579. * @param enumestadolivescoring $showLiveScoring
  2580. * @return Competicion
  2581. */
  2582. public function setShowLiveScoring($showLiveScoring)
  2583. {
  2584. //Si viene vacío metemos el valor por defecto
  2585. $this->show_live_scoring = !empty($showLiveScoring) ? $showLiveScoring : "club";
  2586. return $this;
  2587. }
  2588. /**
  2589. * Get showLiveScoring
  2590. *
  2591. * @return boolean
  2592. */
  2593. public function getShowLiveScoring()
  2594. {
  2595. return $this->show_live_scoring;
  2596. }
  2597. /**
  2598. * Set rfc
  2599. *
  2600. * @param boolean $rfc
  2601. * @return Competicion
  2602. */
  2603. public function setRfc($rfc)
  2604. {
  2605. $this->rfc = $rfc;
  2606. }
  2607. /**
  2608. * Get rfc
  2609. *
  2610. * @return boolean
  2611. */
  2612. public function getRfc()
  2613. {
  2614. return $this->rfc;
  2615. }
  2616. /**
  2617. * Get hcpInscritoMasculino
  2618. *
  2619. * @return integer
  2620. */
  2621. public function getHcpInscritoMasculino()
  2622. {
  2623. return $this->hcp_inscrito_masculino;
  2624. }
  2625. /**
  2626. * Get hcpInscritoMasculinoMin
  2627. *
  2628. * @return integer
  2629. */
  2630. public function getHcpInscritoMasculinoMin()
  2631. {
  2632. return $this->hcp_inscrito_masculino_min;
  2633. }
  2634. /**
  2635. * Get hcpInscritoFemenino
  2636. *
  2637. * @return integer
  2638. */
  2639. public function getHcpInscritoFemenino()
  2640. {
  2641. return $this->hcp_inscrito_femenino;
  2642. }
  2643. /**
  2644. * Get hcpInscritoFemeninoMin
  2645. *
  2646. * @return integer
  2647. */
  2648. public function getHcpInscritoFemeninoMin()
  2649. {
  2650. return $this->hcp_inscrito_femenino_min;
  2651. }
  2652. /**
  2653. * Get hcpJuegoInscripcionMasculinoMin
  2654. *
  2655. * @return integer|null
  2656. */
  2657. public function getHcpJuegoInscripcionMasculinoMin()
  2658. {
  2659. return $this->hcp_juego_inscripcion_masculino_min;
  2660. }
  2661. /**
  2662. * Get hcpJuegoInscripcionMasculinoMax
  2663. *
  2664. * @return integer|null
  2665. */
  2666. public function getHcpJuegoInscripcionMasculinoMax()
  2667. {
  2668. return $this->hcp_juego_inscripcion_masculino_max;
  2669. }
  2670. /**
  2671. * Get hcpJuegoInscripcionFemeninoMin
  2672. *
  2673. * @return integer|null
  2674. */
  2675. public function getHcpJuegoInscripcionFemeninoMin()
  2676. {
  2677. return $this->hcp_juego_inscripcion_femenino_min;
  2678. }
  2679. /**
  2680. * Get hcpJuegoInscripcionFemeninoMax
  2681. *
  2682. * @return integer|null
  2683. */
  2684. public function getHcpJuegoInscripcionFemeninoMax()
  2685. {
  2686. return $this->hcp_juego_inscripcion_femenino_max;
  2687. }
  2688. /**
  2689. * Get hcpJuegoMasculino
  2690. *
  2691. * @return integer
  2692. */
  2693. public function getHcpJuegoMasculino()
  2694. {
  2695. return $this->hcp_juego_masculino;
  2696. }
  2697. /**
  2698. * Get hcpJuegoFemenino
  2699. *
  2700. * @return integer
  2701. */
  2702. public function getHcpJuegoFemenino()
  2703. {
  2704. return $this->hcp_juego_femenino;
  2705. }
  2706. /**
  2707. * Get hcpJuegoPareja
  2708. *
  2709. * @return integer
  2710. */
  2711. public function getHcpJuegoPareja()
  2712. {
  2713. return $this->hcp_juego_pareja;
  2714. }
  2715. /**
  2716. * Get hcpJuegoEquipo
  2717. *
  2718. * @return integer
  2719. */
  2720. public function getHcpJuegoEquipo()
  2721. {
  2722. return $this->hcp_juego_equipo;
  2723. }
  2724. /**
  2725. * Set hcpInscritoMasculino
  2726. *
  2727. * @param integer $hcpInscritoMasculino
  2728. * @return Competicion
  2729. */
  2730. public function setHcpInscritoMasculino($hcpInscritoMasculino)
  2731. {
  2732. $this->hcp_inscrito_masculino = $hcpInscritoMasculino;
  2733. }
  2734. /**
  2735. * Set hcpInscritoFemenino
  2736. *
  2737. * @param integer $hcpInscritoFemenino
  2738. * @return Competicion
  2739. */
  2740. public function setHcpInscritoFemenino($hcpInscritoFemenino)
  2741. {
  2742. $this->hcp_inscrito_femenino = $hcpInscritoFemenino;
  2743. }
  2744. /**
  2745. * Set hcpInscritoMasculinoMin
  2746. *
  2747. * @param integer $hcpInscritoMasculinoMin
  2748. * @return Competicion
  2749. */
  2750. public function setHcpInscritoMasculinoMin($hcpInscritoMasculinoMin)
  2751. {
  2752. $this->hcp_inscrito_masculino_min = $hcpInscritoMasculinoMin;
  2753. }
  2754. /**
  2755. * Set hcpInscritoFemeninoMin
  2756. *
  2757. * @param integer $hcpInscritoFemeninoMin
  2758. * @return Competicion
  2759. */
  2760. public function setHcpInscritoFemeninoMin($hcpInscritoFemeninoMin)
  2761. {
  2762. $this->hcp_inscrito_femenino_min = $hcpInscritoFemeninoMin;
  2763. }
  2764. /**
  2765. * Set hcpJuegoInscripcionMasculinoMin
  2766. *
  2767. * @param integer|null $hcpJuegoInscripcionMasculinoMin
  2768. * @return Competicion
  2769. */
  2770. public function setHcpJuegoInscripcionMasculinoMin($hcpJuegoInscripcionMasculinoMin)
  2771. {
  2772. $this->hcp_juego_inscripcion_masculino_min = $this->normalizeNullableInteger($hcpJuegoInscripcionMasculinoMin);
  2773. }
  2774. /**
  2775. * Set hcpJuegoInscripcionMasculinoMax
  2776. *
  2777. * @param integer|null $hcpJuegoInscripcionMasculinoMax
  2778. * @return Competicion
  2779. */
  2780. public function setHcpJuegoInscripcionMasculinoMax($hcpJuegoInscripcionMasculinoMax)
  2781. {
  2782. $this->hcp_juego_inscripcion_masculino_max = $this->normalizeNullableInteger($hcpJuegoInscripcionMasculinoMax);
  2783. }
  2784. /**
  2785. * Set hcpJuegoInscripcionFemeninoMin
  2786. *
  2787. * @param integer|null $hcpJuegoInscripcionFemeninoMin
  2788. * @return Competicion
  2789. */
  2790. public function setHcpJuegoInscripcionFemeninoMin($hcpJuegoInscripcionFemeninoMin)
  2791. {
  2792. $this->hcp_juego_inscripcion_femenino_min = $this->normalizeNullableInteger($hcpJuegoInscripcionFemeninoMin);
  2793. }
  2794. /**
  2795. * Set hcpJuegoInscripcionFemeninoMax
  2796. *
  2797. * @param integer|null $hcpJuegoInscripcionFemeninoMax
  2798. * @return Competicion
  2799. */
  2800. public function setHcpJuegoInscripcionFemeninoMax($hcpJuegoInscripcionFemeninoMax)
  2801. {
  2802. $this->hcp_juego_inscripcion_femenino_max = $this->normalizeNullableInteger($hcpJuegoInscripcionFemeninoMax);
  2803. }
  2804. /**
  2805. * Set hcpJuegoMasculino
  2806. *
  2807. * @param boolean $hcpJuegoMasculino
  2808. * @return Competicion
  2809. */
  2810. public function setHcpJuegoMasculino($hcpJuegoMasculino)
  2811. {
  2812. $this->hcp_juego_masculino = $hcpJuegoMasculino;
  2813. }
  2814. /**
  2815. * Set hcpJuegoFemenino
  2816. *
  2817. * @param boolean $hcpJuegoFemenino
  2818. * @return Competicion
  2819. */
  2820. public function setHcpJuegoFemenino($hcpJuegoFemenino)
  2821. {
  2822. $this->hcp_juego_femenino = $hcpJuegoFemenino;
  2823. }
  2824. /**
  2825. * Set hcpJuegoPareja
  2826. *
  2827. * @param boolean $hcpJuegoPareja
  2828. * @return Competicion
  2829. */
  2830. public function setHcpJuegoPareja($hcpJuegoPareja)
  2831. {
  2832. $this->hcp_juego_pareja = $hcpJuegoPareja;
  2833. }
  2834. /**
  2835. * Set hcpJuegoEquipo
  2836. *
  2837. * @param boolean $hcpJuegoEquipo
  2838. * @return Competicion
  2839. */
  2840. public function setHcpJuegoEquipo($hcpJuegoEquipo)
  2841. {
  2842. $this->hcp_juego_equipo = $hcpJuegoEquipo;
  2843. }
  2844. /**
  2845. * Converts empty input to null for nullable integer fields.
  2846. *
  2847. * @param mixed $value
  2848. * @return integer|null
  2849. */
  2850. private function normalizeNullableInteger($value)
  2851. {
  2852. if ($value === null) {
  2853. return null;
  2854. }
  2855. if (is_string($value)) {
  2856. $value = trim($value);
  2857. if ($value === '') {
  2858. return null;
  2859. }
  2860. }
  2861. return is_numeric($value) ? (int) $value : null;
  2862. }
  2863. /**
  2864. * Set ficheroVariosNombre
  2865. *
  2866. * @param string $ficheroVariosNombre
  2867. * @return Competicion
  2868. */
  2869. public function setFicheroVariosNombre($ficheroVariosNombre)
  2870. {
  2871. $this->fichero_varios_nombre = $ficheroVariosNombre;
  2872. return $this;
  2873. }
  2874. /**
  2875. * Get ficheroVariosNombre
  2876. *
  2877. * @return string
  2878. */
  2879. public function getFicheroVariosNombre()
  2880. {
  2881. return $this->fichero_varios_nombre;
  2882. }
  2883. /**
  2884. * Set premios
  2885. *
  2886. * @param string $premios
  2887. * @return Competicion
  2888. */
  2889. public function setPremios($premios)
  2890. {
  2891. $this->premios = $premios;
  2892. return $this;
  2893. }
  2894. /**
  2895. * Get premios
  2896. *
  2897. * @return string
  2898. */
  2899. public function getPremios()
  2900. {
  2901. return $this->premios;
  2902. }
  2903. /**
  2904. * Set reglas
  2905. *
  2906. * @param string $reglas
  2907. * @return Competicion
  2908. */
  2909. public function setReglas($reglas)
  2910. {
  2911. $this->reglas = $reglas;
  2912. return $this;
  2913. }
  2914. /**
  2915. * Get reglas
  2916. *
  2917. * @return string
  2918. */
  2919. public function getReglas()
  2920. {
  2921. return $this->reglas;
  2922. }
  2923. /**
  2924. * Set arbitrable
  2925. *
  2926. * @param boolean $arbitrable
  2927. * @return Competicion
  2928. */
  2929. public function setArbitrable($arbitrable)
  2930. {
  2931. $this->arbitrable = $arbitrable;
  2932. return $this;
  2933. }
  2934. /**
  2935. * Get arbitrable
  2936. *
  2937. * @return boolean
  2938. */
  2939. public function getArbitrable()
  2940. {
  2941. return $this->arbitrable;
  2942. }
  2943. /**
  2944. * Set direccionTorneos
  2945. *
  2946. * @param boolean $direccionTorneos
  2947. * @return Competicion
  2948. */
  2949. public function setDireccionTorneos($direccionTorneos)
  2950. {
  2951. $this->direccion_torneos = $direccionTorneos;
  2952. return $this;
  2953. }
  2954. /**
  2955. * Get direccionTorneos
  2956. *
  2957. * @return boolean
  2958. */
  2959. public function getDireccionTorneos()
  2960. {
  2961. return $this->direccion_torneos;
  2962. }
  2963. /**
  2964. * Set asistenciaPresidente
  2965. *
  2966. * @param boolean $asistenciaPresidente
  2967. * @return Competicion
  2968. */
  2969. public function setAsistenciaPresidente($asistenciaPresidente)
  2970. {
  2971. $this->asistencia_presidente = $asistenciaPresidente;
  2972. return $this;
  2973. }
  2974. /**
  2975. * Get asistenciaPresidente
  2976. *
  2977. * @return boolean
  2978. */
  2979. public function getAsistenciaPresidente()
  2980. {
  2981. return $this->asistencia_presidente;
  2982. }
  2983. /**
  2984. * Set institucional
  2985. *
  2986. * @param boolean $institucional
  2987. * @return Competicion
  2988. */
  2989. public function setInstitucional($institucional)
  2990. {
  2991. $this->institucional = $institucional;
  2992. return $this;
  2993. }
  2994. /**
  2995. * Get institucional
  2996. *
  2997. * @return boolean
  2998. */
  2999. public function getInstitucional()
  3000. {
  3001. return $this->institucional;
  3002. }
  3003. /**
  3004. * Set voluntarios
  3005. *
  3006. * @param boolean $voluntarios
  3007. * @return Competicion
  3008. */
  3009. public function setVoluntarios($voluntarios)
  3010. {
  3011. $this->voluntarios = $voluntarios;
  3012. return $this;
  3013. }
  3014. /**
  3015. * Get voluntarios
  3016. *
  3017. * @return boolean
  3018. */
  3019. public function getVoluntarios()
  3020. {
  3021. return $this->voluntarios;
  3022. }
  3023. /**
  3024. * Set flyer
  3025. *
  3026. * @param boolean $flyer
  3027. * @return Competicion
  3028. */
  3029. public function setFlyer($flyer)
  3030. {
  3031. $this->flyer = $flyer;
  3032. return $this;
  3033. }
  3034. /**
  3035. * Get flyer
  3036. *
  3037. * @return boolean
  3038. */
  3039. public function getFlyer()
  3040. {
  3041. return $this->flyer;
  3042. }
  3043. /**
  3044. * Set permitir
  3045. *
  3046. * @param boolean $permitir
  3047. * @return Competicion
  3048. */
  3049. public function setPermitir($permitir)
  3050. {
  3051. $this->permitir = $permitir;
  3052. return $this;
  3053. }
  3054. /**
  3055. * Get permitir
  3056. *
  3057. * @return boolean
  3058. */
  3059. public function getPermitir()
  3060. {
  3061. return $this->permitir;
  3062. }
  3063. /**
  3064. * Set social
  3065. *
  3066. * @param boolean $social
  3067. * @return Competicion
  3068. */
  3069. public function setSocial($social)
  3070. {
  3071. $this->social = $social;
  3072. return $this;
  3073. }
  3074. /**
  3075. * Get social
  3076. *
  3077. * @return boolean
  3078. */
  3079. public function getSocial()
  3080. {
  3081. return $this->social;
  3082. }
  3083. /**
  3084. * Set visible
  3085. *
  3086. * @param boolean $visible
  3087. * @return Competicion
  3088. */
  3089. public function setVisible($visible)
  3090. {
  3091. $this->visible = $visible;
  3092. return $this;
  3093. }
  3094. /**
  3095. * Get visible
  3096. *
  3097. * @return boolean
  3098. */
  3099. public function getVisible()
  3100. {
  3101. return $this->visible;
  3102. }
  3103. /**
  3104. * Set hcpEstricto
  3105. *
  3106. * @param boolean $hcpEstricto
  3107. * @return Competicion
  3108. */
  3109. public function setHcpEstricto($hcpEstricto)
  3110. {
  3111. $this->hcp_estricto = $hcpEstricto;
  3112. return $this;
  3113. }
  3114. /**
  3115. * Get hcpEstricto
  3116. *
  3117. * @return boolean
  3118. */
  3119. public function getHcpEstricto()
  3120. {
  3121. return $this->hcp_estricto;
  3122. }
  3123. public function allowsInscriptionHandicap(?string $sex, $handicap): bool
  3124. {
  3125. $male = strncmp((string) $sex, 'ma', 2) === 0;
  3126. $minimum = $male ? $this->getHcpInscritoMasculinoMin() : $this->getHcpInscritoFemeninoMin();
  3127. $maximum = $male ? $this->getHcpInscritoMasculino() : $this->getHcpInscritoFemenino();
  3128. return StrictHandicap::allows(
  3129. (bool) $this->getHcpEstricto(),
  3130. is_numeric($handicap) ? (float) $handicap : null,
  3131. null === $minimum ? null : (float) $minimum,
  3132. null === $maximum ? null : (float) $maximum
  3133. );
  3134. }
  3135. /**
  3136. * Set popup_inscripcion
  3137. *
  3138. * @param boolean $popup_inscripcion
  3139. * @return Competicion
  3140. */
  3141. public function setPopupInscripcion($popup_inscripcion)
  3142. {
  3143. $this->popup_inscripcion = $popup_inscripcion;
  3144. return $this;
  3145. }
  3146. /**
  3147. * Get popup_inscripcion
  3148. *
  3149. * @return boolean
  3150. */
  3151. public function getPopupInscripcion()
  3152. {
  3153. return $this->popup_inscripcion;
  3154. }
  3155. /**
  3156. * Set popup_inscripcion_texto
  3157. *
  3158. * @param string $popup_inscripcion_texto
  3159. * @return Competicion
  3160. */
  3161. public function setPopupInscripcionTexto($popup_inscripcion_texto)
  3162. {
  3163. $this->popup_inscripcion_texto = $popup_inscripcion_texto;
  3164. return $this;
  3165. }
  3166. /**
  3167. * Get popup_inscripcion_texto
  3168. *
  3169. * @return string
  3170. */
  3171. public function getPopupInscripcionTexto()
  3172. {
  3173. return $this->popup_inscripcion_texto;
  3174. }
  3175. /**
  3176. * Set seguimiento
  3177. *
  3178. * @param boolean $seguimiento
  3179. * @return Competicion
  3180. */
  3181. public function setSeguimiento($seguimiento)
  3182. {
  3183. $this->seguimiento = $seguimiento;
  3184. return $this;
  3185. }
  3186. /**
  3187. * Get seguimiento
  3188. *
  3189. * @return boolean
  3190. */
  3191. public function getSeguimiento()
  3192. {
  3193. return $this->seguimiento;
  3194. }
  3195. /**
  3196. * Set mostrar_sorteo
  3197. *
  3198. * @param boolean $mostrarSorteo
  3199. * @return Competicion
  3200. */
  3201. public function setMostrarSorteo($mostrarSorteo)
  3202. {
  3203. $this->mostrar_sorteo = $mostrarSorteo;
  3204. return $this;
  3205. }
  3206. /**
  3207. * Get mostrar_sorteo
  3208. *
  3209. * @return boolean
  3210. */
  3211. public function getMostrarSorteo()
  3212. {
  3213. return $this->mostrar_sorteo;
  3214. }
  3215. /**
  3216. * Add albaranes
  3217. *
  3218. * @param \App\Entity\Backend\Albaran $albaranes
  3219. * @return Competicion
  3220. */
  3221. public function addAlbarane(\App\Entity\Backend\Albaran $albaranes)
  3222. {
  3223. $this->albaranes[] = $albaranes;
  3224. return $this;
  3225. }
  3226. /**
  3227. * Remove albaranes
  3228. *
  3229. * @param \App\Entity\Backend\Albaran $albaranes
  3230. */
  3231. public function removeAlbarane(\App\Entity\Backend\Albaran $albaranes)
  3232. {
  3233. $this->albaranes->removeElement($albaranes);
  3234. }
  3235. /**
  3236. * Get albaranes
  3237. *
  3238. * @return \Doctrine\Common\Collections\Collection
  3239. */
  3240. public function getAlbaranes()
  3241. {
  3242. return $this->albaranes;
  3243. }
  3244. /**
  3245. * Add adicionales
  3246. *
  3247. * @param \App\Entity\Backend\DatoAdicional $adicionales
  3248. * @return Competicion
  3249. */
  3250. public function addAdicional(\App\Entity\Backend\DatoAdicional $adicionales)
  3251. {
  3252. $adicionales->setCompeticion($this);
  3253. $this->adicionales[] = $adicionales;
  3254. return $this;
  3255. }
  3256. /**
  3257. * Remove adicionales
  3258. *
  3259. * @param \App\Entity\Backend\DatoAdicional $adicionales
  3260. */
  3261. public function removeAdicional(\App\Entity\Backend\DatoAdicional $adicionales)
  3262. {
  3263. $this->adicionales->removeElement($adicionales);
  3264. $adicionales->removeCompeticion();
  3265. }
  3266. /**
  3267. * Get adicionales
  3268. *
  3269. * @return \Doctrine\Common\Collections\Collection
  3270. */
  3271. public function getAdicionales()
  3272. {
  3273. return $this->adicionales;
  3274. }
  3275. public function getAdicionalesFiltered()
  3276. {
  3277. return array_filter($this->adicionales->toArray(), function ($a) {
  3278. return $a->getTipo() != "Privacidad";
  3279. });
  3280. }
  3281. public function getRegistrationForm(): ?CompetitionRegistrationForm
  3282. {
  3283. return $this->registrationForm;
  3284. }
  3285. public function setRegistrationForm(?CompetitionRegistrationForm $registrationForm): self
  3286. {
  3287. $this->registrationForm = $registrationForm;
  3288. return $this;
  3289. }
  3290. /**
  3291. * Set lista_espera
  3292. *
  3293. * @param boolean $lista_espera
  3294. * @return Competicion
  3295. */
  3296. public function setListaEspera($lista_espera)
  3297. {
  3298. $this->lista_espera = $lista_espera;
  3299. return $this;
  3300. }
  3301. /**
  3302. * Get lista_espera
  3303. *
  3304. * @return boolean
  3305. */
  3306. public function getListaEspera()
  3307. {
  3308. return $this->lista_espera;
  3309. }
  3310. public function getRestringirLicencia()
  3311. {
  3312. return $this->restringir_licencia;
  3313. }
  3314. public function setRestringirLicencia($restringir_licencia): self
  3315. {
  3316. $this->restringir_licencia = $restringir_licencia;
  3317. return $this;
  3318. }
  3319. /**
  3320. * Set seleccion_tarifas
  3321. *
  3322. * @param boolean $seleccionTarifas
  3323. * @return Competicion
  3324. */
  3325. public function setSeleccionTarifas($seleccionTarifas)
  3326. {
  3327. $this->seleccion_tarifas = $seleccionTarifas;
  3328. return $this;
  3329. }
  3330. /**
  3331. * Get seleccion_tarifas
  3332. *
  3333. * @return boolean
  3334. */
  3335. public function getSeleccionTarifas()
  3336. {
  3337. return $this->seleccion_tarifas;
  3338. }
  3339. /**
  3340. * Add adicionales
  3341. *
  3342. * @param \App\Entity\Backend\DatoAdicional $adicionales
  3343. * @return Competicion
  3344. */
  3345. public function addAdicionale(\App\Entity\Backend\DatoAdicional $adicionales)
  3346. {
  3347. $this->adicionales[] = $adicionales;
  3348. return $this;
  3349. }
  3350. /**
  3351. * Remove adicionales
  3352. *
  3353. * @param \App\Entity\Backend\DatoAdicional $adicionales
  3354. */
  3355. public function removeAdicionale(\App\Entity\Backend\DatoAdicional $adicionales)
  3356. {
  3357. $this->adicionales->removeElement($adicionales);
  3358. }
  3359. /**
  3360. * Set permitir_extranjeros
  3361. *
  3362. * @param boolean $permitirExtranjeros
  3363. * @return Competicion
  3364. */
  3365. public function setPermitirExtranjeros($permitirExtranjeros)
  3366. {
  3367. $this->permitir_extranjeros = $permitirExtranjeros;
  3368. return $this;
  3369. }
  3370. /**
  3371. * Get permitir_extranjeros
  3372. *
  3373. * @return boolean
  3374. */
  3375. public function getPermitirExtranjeros()
  3376. {
  3377. return $this->permitir_extranjeros;
  3378. }
  3379. /**
  3380. * Set plazas_manana
  3381. *
  3382. * @param integer $plazasManana
  3383. * @return Competicion
  3384. */
  3385. public function setPlazasManana($plazasManana)
  3386. {
  3387. $this->plazas_manana = $plazasManana;
  3388. return $this;
  3389. }
  3390. /**
  3391. * Get plazas_manana
  3392. *
  3393. * @return integer
  3394. */
  3395. public function getPlazasManana()
  3396. {
  3397. return $this->plazas_manana;
  3398. }
  3399. /**
  3400. * Set plazas_tarde
  3401. *
  3402. * @param integer $plazasTarde
  3403. * @return Competicion
  3404. */
  3405. public function setPlazasTarde($plazasTarde)
  3406. {
  3407. $this->plazas_tarde = $plazasTarde;
  3408. return $this;
  3409. }
  3410. /**
  3411. * Get plazas_tarde
  3412. *
  3413. * @return integer
  3414. */
  3415. public function getPlazasTarde()
  3416. {
  3417. return $this->plazas_tarde;
  3418. }
  3419. /**
  3420. * Set tarjeta_electronica
  3421. *
  3422. * @param boolean $tarjeta_electronica
  3423. * @return Competicion
  3424. */
  3425. public function setTarjetaElectronica($tarjeta_electronica)
  3426. {
  3427. $this->tarjeta_electronica = $tarjeta_electronica;
  3428. return $this;
  3429. }
  3430. /**
  3431. * Get tarjeta_electronica
  3432. *
  3433. * @return boolean
  3434. */
  3435. public function getTarjetaElectronica()
  3436. {
  3437. return $this->tarjeta_electronica;
  3438. }
  3439. public function setAutoAssignMarker($auto_assign_marker)
  3440. {
  3441. $this->auto_assign_marker = $auto_assign_marker;
  3442. return $this;
  3443. }
  3444. public function getAutoAssignMarker()
  3445. {
  3446. return $this->auto_assign_marker;
  3447. }
  3448. /**
  3449. * Set codigo_contable
  3450. *
  3451. * @param string $codigoContable
  3452. * @return Competicion
  3453. */
  3454. public function setCodigoContable($codigoContable)
  3455. {
  3456. $this->codigo_contable = $codigoContable;
  3457. return $this;
  3458. }
  3459. /**
  3460. * Get codigo_contable
  3461. *
  3462. * @return string
  3463. */
  3464. public function getCodigoContable()
  3465. {
  3466. return $this->codigo_contable;
  3467. }
  3468. /**
  3469. * Set livescoring_comunidad
  3470. *
  3471. * @param boolean $livescoringComunidad
  3472. * @return Competicion
  3473. */
  3474. public function setLivescoringComunidad($livescoringComunidad)
  3475. {
  3476. $this->livescoring_comunidad = $livescoringComunidad;
  3477. return $this;
  3478. }
  3479. /**
  3480. * Get livescoring_comunidad
  3481. *
  3482. * @return boolean
  3483. */
  3484. public function getLivescoringComunidad()
  3485. {
  3486. return $this->livescoring_comunidad;
  3487. }
  3488. /**
  3489. * Get plazas_lista_espera
  3490. *
  3491. * @return integer
  3492. */
  3493. public function getPlazasListaEspera()
  3494. {
  3495. return $this->plazas_lista_espera;
  3496. }
  3497. /**
  3498. * Set plazas_tarde
  3499. *
  3500. * @param integer $plazasListaEspera
  3501. * @return Competicion
  3502. */
  3503. public function setPlazasListaEspera($plazasListaEspera)
  3504. {
  3505. $this->plazas_lista_espera = $plazasListaEspera;
  3506. return $this;
  3507. }
  3508. /**
  3509. * Get comites
  3510. *
  3511. * @return \Doctrine\Common\Collections\Collection
  3512. */
  3513. public function getNombresComites()
  3514. {
  3515. $nombres = [];
  3516. foreach ($this->comites as $comite) {
  3517. $nombres[] = $comite->getNombre();
  3518. }
  3519. return $nombres;
  3520. }
  3521. public function getDeletedAt()
  3522. {
  3523. return $this->deleted_at;
  3524. }
  3525. public function setDeletedAt($deleted_at)
  3526. {
  3527. $this->deleted_at = $deleted_at;
  3528. }
  3529. /**
  3530. * Set contacto
  3531. *
  3532. * @param string $contacto
  3533. * @return Competicion
  3534. */
  3535. public function setContacto($contacto)
  3536. {
  3537. $this->contacto = $contacto;
  3538. return $this;
  3539. }
  3540. /**
  3541. * Get contacto
  3542. *
  3543. * @return string
  3544. */
  3545. public function getContacto()
  3546. {
  3547. return $this->contacto;
  3548. }
  3549. /**
  3550. * Add rankings
  3551. *
  3552. * @param \App\Entity\Gestion\CompeticionRanking $rankings
  3553. * @return Competicion
  3554. */
  3555. public function addRanking(\App\Entity\Gestion\CompeticionRanking $rankings)
  3556. {
  3557. $this->rankings[] = $rankings;
  3558. return $this;
  3559. }
  3560. /**
  3561. * Remove rankings
  3562. *
  3563. * @param \App\Entity\Gestion\CompeticionRanking $rankings
  3564. */
  3565. public function removeRanking(\App\Entity\Gestion\CompeticionRanking $rankings)
  3566. {
  3567. $this->rankings->removeElement($rankings);
  3568. }
  3569. /**
  3570. * Get rankings
  3571. *
  3572. * @return \Doctrine\Common\Collections\Collection
  3573. */
  3574. public function getRankings()
  3575. {
  3576. return $this->rankings;
  3577. }
  3578. /**
  3579. * Set benefico
  3580. *
  3581. * @param boolean $benefico
  3582. * @return Competicion
  3583. */
  3584. public function setBenefico($benefico)
  3585. {
  3586. $this->benefico = $benefico;
  3587. return $this;
  3588. }
  3589. /**
  3590. * Get benefico
  3591. *
  3592. * @return boolean
  3593. */
  3594. public function getBenefico()
  3595. {
  3596. return $this->benefico;
  3597. }
  3598. /**
  3599. * Add vouchers
  3600. *
  3601. * @param Voucher $vouchers
  3602. * @return Competicion
  3603. */
  3604. public function addVoucher(Voucher $vouchers)
  3605. {
  3606. $this->vouchers[] = $vouchers;
  3607. return $this;
  3608. }
  3609. /**
  3610. * Remove vouchers
  3611. *
  3612. * @param Voucher $vouchers
  3613. */
  3614. public function removeVoucher(Voucher $vouchers)
  3615. {
  3616. $this->vouchers->removeElement($vouchers);
  3617. }
  3618. /**
  3619. * Get vouchers
  3620. *
  3621. * @return \Doctrine\Common\Collections\Collection
  3622. */
  3623. public function getVouchers()
  3624. {
  3625. return $this->vouchers;
  3626. }
  3627. /**
  3628. * Set flickr_gallery
  3629. *
  3630. * @param string $flickr_gallery
  3631. */
  3632. public function setFlickrGallery($flickr_gallery)
  3633. {
  3634. $this->flickr_gallery = $flickr_gallery;
  3635. }
  3636. /**
  3637. * Get flickr_gallery
  3638. *
  3639. * @return string
  3640. */
  3641. public function getFlickrGallery()
  3642. {
  3643. return $this->flickr_gallery;
  3644. }
  3645. /**
  3646. * Set barra_salida
  3647. *
  3648. * @param boolean $barraSalida
  3649. * @return Competicion
  3650. */
  3651. public function setBarraSalida($barraSalida)
  3652. {
  3653. $this->barra_salida = $barraSalida;
  3654. return $this;
  3655. }
  3656. /**
  3657. * Get barra_salida
  3658. *
  3659. * @return boolean
  3660. */
  3661. public function getBarraSalida()
  3662. {
  3663. return $this->barra_salida;
  3664. }
  3665. /**
  3666. * Set observacionesFrontend
  3667. *
  3668. * @param string $observacionesFrontend
  3669. * @return Competicion
  3670. */
  3671. public function setObservacionesFrontend($observacionesFrontend)
  3672. {
  3673. $this->observaciones_frontend = $observacionesFrontend;
  3674. return $this;
  3675. }
  3676. /**
  3677. * Get observacionesFrontend
  3678. *
  3679. * @return string
  3680. */
  3681. public function getObservacionesFrontend()
  3682. {
  3683. return $this->observaciones_frontend;
  3684. }
  3685. public function unlinkIfExist($file)
  3686. {
  3687. if (file_exists($file)) {
  3688. unlink($file);
  3689. }
  3690. }
  3691. public function getMostrarPlazas()
  3692. {
  3693. return $this->mostrar_plazas;
  3694. }
  3695. public function setMostrarPlazas($mostrar_plazas)
  3696. {
  3697. $this->mostrar_plazas = $mostrar_plazas;
  3698. }
  3699. /**
  3700. * Set politica_entrega
  3701. *
  3702. * @param integer $politicaEntrega
  3703. * @return Competicion
  3704. */
  3705. public function setPoliticaEntrega($politicaEntrega)
  3706. {
  3707. $this->politica_entrega = $politicaEntrega;
  3708. return $this;
  3709. }
  3710. /**
  3711. * Get politica_entrega
  3712. *
  3713. * @return integer
  3714. */
  3715. public function getPoliticaEntrega()
  3716. {
  3717. return $this->politica_entrega;
  3718. }
  3719. /**
  3720. * Set politica_inicio
  3721. *
  3722. * @param integer $politicaInicio
  3723. * @return Competicion
  3724. */
  3725. public function setPoliticaInicio($politicaInicio)
  3726. {
  3727. $this->politica_inicio = $politicaInicio;
  3728. return $this;
  3729. }
  3730. /**
  3731. * Get politica_inicio
  3732. *
  3733. * @return integer
  3734. */
  3735. public function getPoliticaInicio()
  3736. {
  3737. return $this->politica_inicio;
  3738. }
  3739. public function getShortUrl(): ?string
  3740. {
  3741. return $this->short_url;
  3742. }
  3743. public function setShortUrl(?string $short_url): self
  3744. {
  3745. $this->short_url = $short_url;
  3746. return $this;
  3747. }
  3748. public function getPrivada(): ?bool
  3749. {
  3750. return $this->privada;
  3751. }
  3752. public function setPrivada(bool $privada): self
  3753. {
  3754. $this->privada = $privada;
  3755. return $this;
  3756. }
  3757. public function getMarcadorRfc(): ?MarcadorRfc
  3758. {
  3759. return $this->marcadorRfc;
  3760. }
  3761. public function setMarcadorRfc(MarcadorRfc $marcadorRfc): self
  3762. {
  3763. // set the owning side of the relation if necessary
  3764. if ($marcadorRfc->getCompeticion() !== $this) {
  3765. $marcadorRfc->setCompeticion($this);
  3766. }
  3767. $this->marcadorRfc = $marcadorRfc;
  3768. return $this;
  3769. }
  3770. /**
  3771. * @return Collection<int, MensajeTorneo>
  3772. */
  3773. public function getMensajeTorneos(): Collection
  3774. {
  3775. return $this->mensajeTorneos;
  3776. }
  3777. public function addMensajeTorneo(MensajeTorneo $mensajeTorneo): self
  3778. {
  3779. if (!$this->mensajeTorneos->contains($mensajeTorneo)) {
  3780. $this->mensajeTorneos[] = $mensajeTorneo;
  3781. $mensajeTorneo->setCompeticion($this);
  3782. }
  3783. return $this;
  3784. }
  3785. public function removeMensajeTorneo(MensajeTorneo $mensajeTorneo): self
  3786. {
  3787. if ($this->mensajeTorneos->removeElement($mensajeTorneo)) {
  3788. // set the owning side to null (unless already changed)
  3789. if ($mensajeTorneo->getCompeticion() === $this) {
  3790. $mensajeTorneo->setCompeticion(null);
  3791. }
  3792. }
  3793. return $this;
  3794. }
  3795. public function getRondas(): Collection
  3796. {
  3797. return $this->rondas;
  3798. }
  3799. public function getCameraUrl(): ?string
  3800. {
  3801. return $this->camera_url;
  3802. }
  3803. public function setCameraUrl(?string $camera_url): self
  3804. {
  3805. $this->camera_url = $camera_url;
  3806. return $this;
  3807. }
  3808. public function getCode(): string
  3809. {
  3810. return $this->getOrganizador()->getId() . "_" . $this->getId();
  3811. }
  3812. public function getTipoConfiguracionMatchplay()
  3813. {
  3814. return $this->tipo_configuracion_matchplay;
  3815. }
  3816. public function setTipoConfiguracionMatchplay($tipo_configuracion_matchplay): self
  3817. {
  3818. $this->tipo_configuracion_matchplay = $tipo_configuracion_matchplay;
  3819. return $this;
  3820. }
  3821. public function getLiquidationDate(): ?\DateTime
  3822. {
  3823. return $this->liquidation_date;
  3824. }
  3825. public function setLiquidationDate($liquidation_date): self
  3826. {
  3827. $this->liquidation_date = $liquidation_date;
  3828. return $this;
  3829. }
  3830. public function getCollectionDate(): ?\DateTime
  3831. {
  3832. return $this->collection_date;
  3833. }
  3834. public function setCollectionDate($collection_date): self
  3835. {
  3836. $this->collection_date = $collection_date;
  3837. return $this;
  3838. }
  3839. /**
  3840. * @return Collection<int, CompetitionSectionHidden>
  3841. */
  3842. public function getCompetitionSectionHidden(): Collection
  3843. {
  3844. return $this->competitionSectionHidden;
  3845. }
  3846. public function addCompetitionSectionHidden(CompetitionSectionHidden $competitionSectionHidden): self
  3847. {
  3848. if (!$this->competitionSectionHidden->contains($competitionSectionHidden)) {
  3849. $this->competitionSectionHidden[] = $competitionSectionHidden;
  3850. $competitionSectionHidden->setCompetition($this);
  3851. }
  3852. return $this;
  3853. }
  3854. public function removeCompetitionSectionHidden(CompetitionSectionHidden $competitionSectionHidden): self
  3855. {
  3856. if ($this->competitionSectionHidden->removeElement($competitionSectionHidden)) {
  3857. // set the owning side to null (unless already changed)
  3858. if ($competitionSectionHidden->getCompetition() === $this) {
  3859. $competitionSectionHidden->setCompetition(null);
  3860. }
  3861. }
  3862. return $this;
  3863. }
  3864. public function getLivescoringPolicy(): string
  3865. {
  3866. return $this->livescoring_policy;
  3867. }
  3868. public function setLivescoringPolicy(?string $livescoringPolicy): self
  3869. {
  3870. $this->livescoring_policy = $livescoringPolicy ?? EnumLivescoringPolicy::PLAYER_RESULTS;
  3871. return $this;
  3872. }
  3873. public function isRyderCup(): bool
  3874. {
  3875. return $this->getFormula() && \App\DBAL\General\EnumCompetitionFormula::RYDER_CUP === $this->getFormula()->getId();
  3876. }
  3877. public function getLivescoringFormula(): string
  3878. {
  3879. return $this->livescoring_formula;
  3880. }
  3881. public function setLivescoringFormula(?string $livescoring_formula): void
  3882. {
  3883. $this->livescoring_formula = $livescoring_formula ?? EnumLivescoringFormula::HANDICAP_SCRATCH;
  3884. }
  3885. public function isShowEvents(): bool
  3886. {
  3887. return $this->show_events;
  3888. }
  3889. public function setShowEvents($show_events): void
  3890. {
  3891. $this->show_events = $show_events;
  3892. }
  3893. public function getGroupsByInscribed(): array
  3894. {
  3895. if (empty($this->getInscritos())) {
  3896. return [];
  3897. }
  3898. return array_unique($this->getInscritos()->filter(function (Inscrito $inscribed) {
  3899. return !empty($inscribed->getAgrupacion());
  3900. })->map(function (Inscrito $inscribed) {
  3901. return $inscribed->getAgrupacion();
  3902. })->toArray());
  3903. }
  3904. public function isAdvancedHcpCalculation(): bool
  3905. {
  3906. return $this->advanced_hcp_calculation;
  3907. }
  3908. public function setAdvancedHcpCalculation(bool $advanced_hcp_calculation): self
  3909. {
  3910. $this->advanced_hcp_calculation = $advanced_hcp_calculation;
  3911. return $this;
  3912. }
  3913. public function isApplyAverageHcp(): bool
  3914. {
  3915. return $this->apply_average_hcp;
  3916. }
  3917. public function setApplyAverageHcp(bool $apply_average_hcp): self
  3918. {
  3919. $this->apply_average_hcp = $apply_average_hcp;
  3920. return $this;
  3921. }
  3922. public function getLowerHandicapsToUse(): int
  3923. {
  3924. return $this->lower_handicaps_to_use ?? self::DEFAULT_LOWER_HANDICAPS_TO_USE;
  3925. }
  3926. public function setLowerHandicapsToUse(?int $lower_handicaps_to_use): self
  3927. {
  3928. $this->lower_handicaps_to_use = $lower_handicaps_to_use ?? self::DEFAULT_LOWER_HANDICAPS_TO_USE;
  3929. return $this;
  3930. }
  3931. public function isUseFirstRoundDateForHandicap(): bool
  3932. {
  3933. return (bool) $this->use_first_round_date_for_handicap;
  3934. }
  3935. public function setUseFirstRoundDateForHandicap(bool $use_first_round_date_for_handicap): self
  3936. {
  3937. $this->use_first_round_date_for_handicap = $use_first_round_date_for_handicap;
  3938. return $this;
  3939. }
  3940. public function isUseWithoutRfcHandicap(): bool
  3941. {
  3942. return (bool) $this->use_without_rfc_handicap;
  3943. }
  3944. public function setUseWithoutRfcHandicap(bool $use_without_rfc_handicap): self
  3945. {
  3946. $this->use_without_rfc_handicap = $use_without_rfc_handicap;
  3947. return $this;
  3948. }
  3949. public function getWithoutRfcHandicapDifference(): float
  3950. {
  3951. return round((float) $this->without_rfc_handicap_difference, 1);
  3952. }
  3953. public function setWithoutRfcHandicapDifference(float $without_rfc_handicap_difference): self
  3954. {
  3955. if ($without_rfc_handicap_difference < 0) {
  3956. throw new \InvalidArgumentException('El diferencial de HCP SIN RFC no puede ser negativo.');
  3957. }
  3958. $this->without_rfc_handicap_difference = round(
  3959. $without_rfc_handicap_difference,
  3960. 1,
  3961. PHP_ROUND_HALF_UP
  3962. );
  3963. return $this;
  3964. }
  3965. public function getCanPutBall(): ?bool
  3966. {
  3967. return $this->can_put_ball;
  3968. }
  3969. public function setCanPutBall(?bool $can_put_ball): self
  3970. {
  3971. $this->can_put_ball = $can_put_ball;
  3972. return $this;
  3973. }
  3974. public function getCanUseMeters(): ?bool
  3975. {
  3976. return $this->can_use_meters;
  3977. }
  3978. public function setCanUseMeters(?bool $can_use_meters): self
  3979. {
  3980. $this->can_use_meters = $can_use_meters;
  3981. return $this;
  3982. }
  3983. public function getCanGiveAdvice(): ?bool
  3984. {
  3985. return $this->can_give_advice;
  3986. }
  3987. public function setCanGiveAdvice(?bool $can_give_advice): self
  3988. {
  3989. $this->can_give_advice = $can_give_advice;
  3990. return $this;
  3991. }
  3992. public function getEcardInitialMessage(): ?string
  3993. {
  3994. return $this->ecard_initial_message;
  3995. }
  3996. public function setEcardInitialMessage(?string $ecard_initial_message): self
  3997. {
  3998. $this->ecard_initial_message = $ecard_initial_message;
  3999. return $this;
  4000. }
  4001. public function isHoleDistance(): bool
  4002. {
  4003. return $this->hole_distance;
  4004. }
  4005. public function getHoleDistance(): bool
  4006. {
  4007. return $this->hole_distance;
  4008. }
  4009. public function setHoleDistance(bool $hole_distance): self
  4010. {
  4011. $this->hole_distance = $hole_distance;
  4012. return $this;
  4013. }
  4014. /**
  4015. * @return Collection<int, RfcCompetition>
  4016. */
  4017. public function getRfcCompetitions(): Collection
  4018. {
  4019. return $this->rfcCompetitions;
  4020. }
  4021. public function addRfcCompetition(RfcCompetition $rfcCompetition): self
  4022. {
  4023. if (!$this->rfcCompetitions->contains($rfcCompetition)) {
  4024. $this->rfcCompetitions[] = $rfcCompetition;
  4025. $rfcCompetition->setCompetition($this);
  4026. }
  4027. return $this;
  4028. }
  4029. public function removeRfcCompetition(RfcCompetition $rfcCompetition): self
  4030. {
  4031. if ($this->rfcCompetitions->removeElement($rfcCompetition)) {
  4032. // set the owning side to null (unless already changed)
  4033. if ($rfcCompetition->getCompetition() === $this) {
  4034. $rfcCompetition->setCompetition(null);
  4035. }
  4036. }
  4037. return $this;
  4038. }
  4039. }