refactor: documents
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Documents\Service;
|
||||
|
||||
use KTXF\Resource\Documents\Entity\EntityBaseInterface;
|
||||
use KTXF\Resource\Documents\Entity\EntityMutableInterface;
|
||||
|
||||
/**
|
||||
* Chrono Service Entity Mutable Interface
|
||||
*
|
||||
* Optional interface for services that support entity CRUD operations.
|
||||
* Provides entity creation, modification, deletion, copying, moving, and flag management.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ServiceEntityMutableInterface extends ServiceBaseInterface {
|
||||
|
||||
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
|
||||
public const CAPABILITY_ENTITY_UPDATE = 'EntityUpdate';
|
||||
public const CAPABILITY_ENTITY_DELETE = 'EntityDelete';
|
||||
public const CAPABILITY_ENTITY_COPY = 'EntityCopy';
|
||||
public const CAPABILITY_ENTITY_MOVE = 'EntityMove';
|
||||
public const CAPABILITY_ENTITY_WRITE = 'EntityWrite';
|
||||
|
||||
/**
|
||||
* Creates a fresh entity instance for composition
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return EntityMutableInterface Fresh entity object
|
||||
*/
|
||||
public function entityFresh(): EntityMutableInterface;
|
||||
|
||||
/**
|
||||
* Creates/imports an entity into a collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection collection identifier
|
||||
* @param EntityMutableInterface $entity Entity data
|
||||
* @param array $options additional options
|
||||
*
|
||||
* @return EntityBaseInterface Created entity
|
||||
*/
|
||||
public function entityCreate(string|int $collection, EntityMutableInterface $entity, array $options = []): EntityBaseInterface;
|
||||
|
||||
/**
|
||||
* Modifies an existing entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection Collection identifier
|
||||
* @param string|int $identifier Entity identifier
|
||||
* @param EntityMutableInterface $entity Entity data
|
||||
*
|
||||
* @return EntityBaseInterface Modified entity
|
||||
*/
|
||||
public function entityUpdate(string|int $collection, string|int $identifier, EntityMutableInterface $entity): EntityBaseInterface;
|
||||
/**
|
||||
* Deletes an existing entity in the specified collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection Collection identifier
|
||||
* @param string|int $identifier Entity identifier to delete
|
||||
*
|
||||
* @return EntityBaseInterface Deleted entity
|
||||
*/
|
||||
public function entityDelete(string|int $collection, string|int $identifier): EntityBaseInterface;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user