castopod/app/Entities/PodcastPerson.php
Yassine Doghri 231d578d64
refactor: add phpstan and update code to adhere to level 5
- move and refactor Image.php from Libraries to Entities folder
- update some database field names
/ types
- update composer packages
2021-05-12 14:00:25 +00:00

47 lines
934 B
PHP

<?php
/**
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Entities;
use CodeIgniter\Entity\Entity;
use App\Models\PersonModel;
/**
* @property int $id
* @property int $podcast_id
* @property int $person_id
* @property Person $person
* @property string|null $person_group
* @property string|null $person_role
*/
class PodcastPerson extends Entity
{
/**
* @var Person
*/
protected $person;
/**
* @var array<string, string>
*/
protected $casts = [
'id' => 'integer',
'podcast_id' => 'integer',
'person_id' => 'integer',
'person_group' => '?string',
'person_role' => '?string',
];
public function getPerson(): ?Person
{
return (new PersonModel())->getPersonById(
$this->attributes['person_id'],
);
}
}