Skip to content
Snippets Groups Projects
Category.php 746 B
Newer Older
  • Learn to ignore specific revisions
  • /**
     * @copyright  2020 Podlibre
     * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
     * @link       https://castopod.org/
     */
    
    use App\Models\CategoryModel;
    
    use CodeIgniter\Entity;
    
    class Category extends Entity
    {
    
        /**
         * @var \App\Entity\Category|null
         */
    
            'apple_category' => 'string',
            'google_category' => 'string',
        ];
    
    
        public function getParent()
        {
    
            $parentId = $this->attributes['parent_id'];
    
            return $parentId != 0
                ? (new CategoryModel())->findParent($parentId)