DatabaseEventCategoryRepository
in package
implements
IEventCategoryRepository
Database-backed event category repository.
Works with SQLite, MySQL, and PostgreSQL.
Table of Contents
Interfaces
- IEventCategoryRepository
- Repository interface for EventCategory entities.
Properties
- $_pdo : PDO
Methods
- __construct() : mixed
- Constructor
- all() : array<string|int, EventCategory>
- Get all event categories
- create() : EventCategory
- Create new category
- delete() : bool
- Delete category
- findById() : EventCategory|null
- Find category by ID
- findByIds() : array<string|int, EventCategory>
- Find categories by IDs
- findBySlug() : EventCategory|null
- Find category by slug
- slugExists() : bool
- Check if category slug exists
- update() : EventCategory
- Update category
Properties
$_pdo
private
PDO
$_pdo
Methods
__construct()
Constructor
public
__construct(SettingManager $settings) : mixed
Parameters
- $settings : SettingManager
-
Settings manager with database configuration
Tags
all()
Get all event categories
public
all() : array<string|int, EventCategory>
Return values
array<string|int, EventCategory>create()
Create new category
public
create(EventCategory $category) : EventCategory
Parameters
- $category : EventCategory
Return values
EventCategorydelete()
Delete category
public
delete(EventCategory $category) : bool
Parameters
- $category : EventCategory
Return values
boolfindById()
Find category by ID
public
findById(int $id) : EventCategory|null
Parameters
- $id : int
Return values
EventCategory|nullfindByIds()
Find categories by IDs
public
findByIds(array<string|int, mixed> $ids) : array<string|int, EventCategory>
Parameters
- $ids : array<string|int, mixed>
Return values
array<string|int, EventCategory>findBySlug()
Find category by slug
public
findBySlug(string $slug) : EventCategory|null
Parameters
- $slug : string
Return values
EventCategory|nullslugExists()
Check if category slug exists
public
slugExists(string $slug[, int|null $excludeId = null ]) : bool
Parameters
- $slug : string
- $excludeId : int|null = null
Return values
boolupdate()
Update category
public
update(EventCategory $category) : EventCategory
Parameters
- $category : EventCategory