File: D:/HostingSpaces/bomacon/bomacon.nl/app/Components/ComponentArea/ComponentAreaServiceInterface.php
<?php
declare(strict_types=1);
namespace App\Components\ComponentArea;
use App\Components\Component\Component;
use App\Components\Component\ComponentSaveState;
use App\Components\ComponentType\Types\AbstractComponentType;
use Illuminate\Database\Eloquent\Model;
use Komma\KMS\Core\AbstractModelHandlerInterface;
use Komma\KMS\Core\Attributes\Attribute;
/**
* Class ComponentAreasService
*
* To save and load Components from the database via a ComponentAreas attribute.
*/
interface ComponentAreaServiceInterface extends AbstractModelHandlerInterface
{
/**
* Convert the json in the ComponentAreasAttribute into a componentAreas with Components and save them
* The json comes from componentAreaManager.js
*
* @param Model $model
* @param Attribute $attribute
* @return HasComponentAreasInterface
* @throws \ReflectionException
* @throws \Throwable
*/
public function saveAttribute(Model $model, Attribute $attribute): Model;
/**
* Convert a componentArea with its Components to a json string which componentAreaManager.js can handle
*
* @param Model $model
* @param Attribute $attribute
* @return Attribute
*/
public function loadAttribute(Model $model, Attribute $attribute): Attribute;
/**
* Gets the components save state.
* Notice that this is not only the components data attribute.
* Some of the data also comes from Attributable models, stored elsewhere in the database.
*
* @param Component $component
* @return ComponentSaveState
*/
public function getComponentSaveStateForComponent(Component $component): ComponentSaveState;
/**
* Loops over all attributes in a component and modifies their keys so that they become ComponentAttribute keys.
* In those keys it is made clear for which component and attribute the key is for.
*
* @param AbstractComponentType $componentType
* @param string $componentAreaAttributeKeyAsString
* @param int $componentId
* @return AbstractComponentType
*/
public static function generateComponentAttributeKeysForComponent(AbstractComponentType $componentType, string $componentAreaAttributeKeyAsString, int $componentId);
}