sintonia/legacy/application/models/airtime/CcShow.php
renovate[bot] 9192aaa2bb
fix(deps): update dependency friendsofphp/php-cs-fixer to <3.53.1 (#2972)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[friendsofphp/php-cs-fixer](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer)
| `<3.51.1` -> `<3.53.1` |
[![age](https://developer.mend.io/api/mc/badges/age/packagist/friendsofphp%2fphp-cs-fixer/3.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/friendsofphp%2fphp-cs-fixer/3.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/friendsofphp%2fphp-cs-fixer/3.51.0/3.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/friendsofphp%2fphp-cs-fixer/3.51.0/3.53.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>PHP-CS-Fixer/PHP-CS-Fixer (friendsofphp/php-cs-fixer)</summary>

###
[`v3.53.0`](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3530)

[Compare
Source](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.52.1...v3.53.0)

- chore: Use `list` over `array` in more places
([#&#8203;7905](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7905))
- CI: allow for self-approvals for maintainers
([#&#8203;7921](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7921))
- CI: Improve Infection setup
([#&#8203;7913](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7913))
- CI: no need to trigger enable auto-merge when self-approve
([#&#8203;7929](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7929))
- DX: reduce `array_filter` function usages
([#&#8203;7923](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7923))
- DX: remove duplicated character from `trim` call
([#&#8203;7930](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7930))
- DX: update actions producing warnings
([#&#8203;7925](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7925))
- DX: update actions producing warnings
([#&#8203;7928](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7928))
- DX: update `phpstan/phpstan-strict-rules`
([#&#8203;7924](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7924))
- feat: Add trailing comma in multiline to PER-CS 2.0
([#&#8203;7916](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7916))
- feat: Introduce `AttributeAnalysis`
([#&#8203;7909](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7909))
- feat: `@PHP84Migration` introduction
([#&#8203;7774](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7774))
- fix: Constant invocation detected in typed constants
([#&#8203;7892](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7892))
- fix: `PhpdocArrayTypeFixer` - JIT stack limit exhausted
([#&#8203;7895](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7895))
- test: Introduce Infection for mutation tests
([#&#8203;7874](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7874))

###
[`v3.52.1`](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3521)

[Compare
Source](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.52.0...v3.52.1)

- fix: StatementIndentationFixer - do not crash on ternary operator in
class property
([#&#8203;7899](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7899))
- fix: `PhpCsFixer\Tokenizer\Tokens::setSize` return type
([#&#8203;7900](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7900))

###
[`v3.52.0`](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3520)

[Compare
Source](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.51.0...v3.52.0)

- chore: fix PHP 8.4 deprecations
([#&#8203;7894](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7894))
- chore: fix PHPStan 1.10.60 issues
([#&#8203;7873](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7873))
- chore: list over array in more places
([#&#8203;7876](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7876))
- chore: replace template with variable in Preg class
([#&#8203;7882](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7882))
- chore: update PHPStan
([#&#8203;7871](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7871))
- depr: `nullable_type_declaration_for_default_null_value` - deprecate
option that is against `@PHP84Migration`
([#&#8203;7872](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7872))
- docs: Fix typo
([#&#8203;7889](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7889))
- feat: Add support for callable template in PHPDoc parser
([#&#8203;7084](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7084))
- feat: Add `array_indentation` to `PER-CS2.0` ruleset
([#&#8203;7881](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7881))
- feat: `@Symfony:risky` - add `no_unreachable_default_argument_value`
([#&#8203;7863](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7863))
- feat: `PhpCsFixer` ruleset - enable
`nullable_type_declaration_for_default_null_value`
([#&#8203;7870](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7870))
- fix: Constant invocation detected in DNF types
([#&#8203;7869](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7869))
- fix: Correctly indent multiline constants and properties
([#&#8203;7875](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7875))
- fix: `no_useless_concat_operator` - do not break variable
([#&#8203;7827](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7827))
- fix: `TokensAnalyzer` - handle unary operator in arrow functions
([#&#8203;7862](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7862))
- fix: `TypeExpression` - fix "JIT stack limit exhausted" error
([#&#8203;7843](https://togithub.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7843))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/libretime/libretime).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNDUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: jo <ljonas@riseup.net>
2024-04-13 14:36:31 +02:00

333 lines
12 KiB
PHP

<?php
/**
* Skeleton subclass for representing a row from the 'cc_show' table.
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*/
class CcShow extends BaseCcShow
{
/*
* Returns all cc_show_day rules that belong to a cc_show and that are
* repeating.
* We do this because editing a single instance from a repeating sequence
* creates a new rule in cc_show_days with the same cc_show id and a repeat
* type of -1 (non-repeating).
* So when the entire cc_show is updated after that, the single edited
* instance can remain separate from the rest of the instances
*/
public function getRepeatingCcShowDays()
{
return CcShowDaysQuery::create()
->filterByDbShowId($this->id)
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
->find();
}
/**
* Gets an array of CcShowDays objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcShow is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
*
* @return array|PropelCollection CcShowDays[] List of CcShowDays objects
*
* @throws PropelException
*/
public function getFirstCcShowDay($criteria = null, ?PropelPDO $con = null)
{
/*CcShowPeer::clearInstancePool();
CcShowPeer::clearRelatedInstancePool();*/
if (null === $this->collCcShowDayss || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowDayss) {
// return empty collection
$this->initCcShowDayss();
} else {
$collCcShowDayss = CcShowDaysQuery::create(null, $criteria)
->filterByCcShow($this)
->orderByDbFirstShow()
->limit(1)
->find($con);
if (null !== $criteria) {
return $collCcShowDayss;
}
$this->collCcShowDayss = $collCcShowDayss;
}
}
return $this->collCcShowDayss[0];
}
/**
* A repeating show may have a rule in cc_show_days with a repeat type
* of -1 (not repeating). This happens when a single instances was edited
* from the repeating sequence.
*
* When the repeating show gets edited in this case, we want to exclude all
* the edited instances from the update. We do this by not returning any of
* the cc_show_day rules with a -1 repeat type.
*/
public function getFirstRepeatingCcShowDay()
{
return CcShowDaysQuery::create()
->filterByDbShowId($this->id)
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
->orderByDbFirstShow()
->findOne();
}
/**
* In order to determine if a show is repeating we need to check each
* cc_show_day entry and check if there are any non -1 repeat types.
* Because editing a single instances creates a new cc_show_day rule
* with a -1 (non repeating) repeat type we need to check all cc_show_day
* entries.
*/
public function isRepeating()
{
// get all cc_show_day entries that are repeating
$ccShowDays = CcShowDaysQuery::create()
->filterByDbShowId($this->id)
->filterByDbRepeatType(0, Criteria::GREATER_EQUAL)
->find();
if (!$ccShowDays->isEmpty()) {
return true;
}
return false;
}
/**
* Returns all cc_show_instances that have been edited out of
* a repeating sequence.
*/
public function getEditedRepeatingInstanceIds()
{
// get cc_show_days that have been edited (not repeating)
$ccShowDays = CcShowDaysQuery::create()
->filterByDbShowId($this->id)
->filterByDbRepeatType(-1)
->find();
$startsUTC = [];
$utc = new DateTimeZone('UTC');
foreach ($ccShowDays as $day) {
// convert to UTC
$starts = new DateTime(
$day->getDbFirstShow() . ' ' . $day->getDbStartTime(),
new DateTimeZone($day->getDbTimezone())
);
$starts->setTimezone($utc);
array_push($startsUTC, $starts->format('Y-m-d H:i:s'));
}
$excludeInstances = CcShowInstancesQuery::create()
->filterByDbShowId($this->id)
->filterByDbStarts($startsUTC, criteria::IN)
->find();
$excludeIds = [];
foreach ($excludeInstances as $instance) {
array_push($excludeIds, $instance->getDbId());
}
return $excludeIds;
}
/**
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcShow is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
*
* @return array|PropelCollection CcShowInstances[] List of CcShowInstances objects
*
* @throws PropelException
*/
public function getFutureCcShowInstancess($criteria = null, ?PropelPDO $con = null)
{
if (null === $this->collCcShowInstancess || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowInstancess) {
// return empty collection
$this->initCcShowInstancess();
} else {
$collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
->filterByCcShow($this)
->filterByDbStarts(gmdate('Y-m-d H:i:s'), Criteria::GREATER_THAN)
->filterByDbModifiedInstance(false)
->find($con);
if (null !== $criteria) {
return $collCcShowInstancess;
}
$this->collCcShowInstancess = $collCcShowInstancess;
}
}
return $this->collCcShowInstancess;
}
public function isRecorded()
{
$ccShowDay = CcShowDaysQuery::create()
->filterByDbShowId($this->getDbId())
->filterByDbRecord(1)
->findOne();
return !is_null($ccShowDay);
}
public function isRebroadcast()
{
$ccShowRebroadcast = CcShowRebroadcastQuery::create()
->filterByDbShowId($this->getDbId())
->findOne();
return !is_null($ccShowRebroadcast);
}
public function getRebroadcastsRelative()
{
return CcShowRebroadcastQuery::create()
->filterByDbShowId($this->getDbId())
->orderByDbDayOffset()
->find();
}
public function getRebroadcastsAbsolute()
{
return CcShowInstancesQuery::create()
->filterByDbShowId($this->getDbId())
->filterByDbRebroadcast(1)
->filterByDbModifiedInstance(false)
->orderByDbStarts()
->find();
}
public function isLinked()
{
return $this->getDbLinked();
}
public function isLinkable()
{
return $this->getDbIsLinkable();
}
/**
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcShow is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
*
* @return array|PropelCollection CcShowInstances[] List of CcShowInstances objects
*
* @throws PropelException
*/
public function getCcShowInstancess($criteria = null, ?PropelPDO $con = null)
{
return CcShowInstancesQuery::create(null, $criteria)
->filterByCcShow($this)
->filterByDbModifiedInstance(false)
->orderByDbId()
->find($con);
/*if(null === $this->collCcShowInstancess || null !== $criteria) {
if ($this->isNew() && null === $this->collCcShowInstancess) {
// return empty collection
$this->initCcShowInstancess();
} else {
$collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
->filterByCcShow($this)
->filterByDbModifiedInstance(false)
->filterByDbStarts(gmdate("Y-m-d H:i:s"), criteria::GREATER_THAN)
->orderByDbId()
->find($con);
if (null !== $criteria) {
return $collCcShowInstancess;
}
$this->collCcShowInstancess = $collCcShowInstancess;
}
}
return $this->collCcShowInstancess;*/
}
public function getInstanceIds()
{
$instanceIds = [];
foreach ($this->getCcShowInstancess() as $ccShowInstance) {
$instanceIds[] = $ccShowInstance->getDbId();
}
return $instanceIds;
}
/*
* Returns cc_show_instance ids where the start time is greater than
* the current time
*
* If a Criteria object is passed in Propel will always fetch the
* results from the database and not return a cached collection
*/
public function getFutureInstanceIds($criteria = null)
{
$instanceIds = [];
foreach ($this->getFutureCcShowInstancess($criteria) as $ccShowInstance) {
$instanceIds[] = $ccShowInstance->getDbId();
}
return $instanceIds;
}
// what is this??
public function getOtherInstances($instanceId)
{
return CcShowInstancesQuery::create()
->filterByCcShow($this)
->filterByDbId($instanceId, Criteria::NOT_EQUAL)
->find();
}
public function getShowInfo()
{
$info = [];
if ($this->getDbId() == null) {
return $info;
}
$info['name'] = $this->getDbName();
$info['id'] = $this->getDbId();
$info['url'] = $this->getDbUrl();
$info['genre'] = $this->getDbGenre();
$info['description'] = $this->getDbDescription();
$info['color'] = $this->getDbColor();
$info['background_color'] = $this->getDbBackgroundColor();
$info['linked'] = $this->getDbLinked();
$info['has_autoplaylist'] = $this->getDbHasAutoPlaylist();
$info['autoplaylist_id'] = $this->getDbAutoPlaylistId();
$info['autoplaylist_repeat'] = $this->getDbAutoPlaylistRepeat();
return $info;
}
} // CcShow