Neuron-PHP

Updater
in package
implements IPostUpdater

Post update service.

Updates existing posts and their relationships.

Table of Contents

Interfaces

IPostUpdater
Post updater service interface

Properties

$_categoryRepository  : ICategoryRepository
$_postRepository  : IPostRepository
$_slugGenerator  : SlugGenerator
$_tagResolver  : Resolver

Methods

__construct()  : mixed
update()  : Post
Update an existing post from DTO
generateSlug()  : string
Generate URL-friendly slug from title

Properties

Methods

update()

Update an existing post from DTO

public update(Dto $request[, array<string|int, mixed> $categoryIds = [] ][, string $tagNames = '' ]) : Post
Parameters
$request : Dto

DTO containing id, title, content, status, slug, excerpt, featured_image

$categoryIds : array<string|int, mixed> = []

Array of category IDs

$tagNames : string = ''

Comma-separated tag names

Tags
throws
Exception

If post not found

Return values
Post

generateSlug()

Generate URL-friendly slug from title

private generateSlug(string $title) : string

For titles with only non-ASCII characters (e.g., "你好", "مرحبا"), generates a fallback slug using a unique identifier.

Parameters
$title : string
Return values
string

        
On this page

Search results