com\setasign\Konquadrat\Object

ObjectManager Class ObjectManager - Used to create and save objects

File: /Konquadrat/src/Object/ObjectManager.php

Class hierarchy

Implements

  • \Psr\Log\LoggerAwareInterface

Summary

Properties

$database

$history

$instancePoolManager

$logger

protected ?\Psr\Log\LoggerInterface ObjectManager::$logger

$objectConfig

$objectFactory

$objectTableManager

$transactionManager


Methods

__construct()

public ObjectManager::__construct (
ObjectConfig $objectConfig,
\com\setasign\SetaFramework\Database\Database $database,
ObjectTableManager $objectTableManager,
ObjectFactoryInterface $objectFactory,
InstancePoolManager $instancePoolManager,
TransactionManager $transactionManager,
History $history
)
Parameters
$objectConfig : ObjectConfig
 
$database : \com\setasign\SetaFramework\Database\Database
 
$objectTableManager : ObjectTableManager
 
$objectFactory : ObjectFactoryInterface
 
$instancePoolManager : InstancePoolManager
 
$transactionManager : TransactionManager
 
$history : History
 

create()

public ObjectManager::create (
class-string<T> $type
): AbstractObjectInterface

Creates a new object of the type $type.

Parameters
$type : class-string<T>

Must be a valid object type

createPath()

protected ObjectManager::createPath (
int $id,
?AbstractObjectInterface $parent
): void

We have to create the path after first saving. Because the object doesn't have an id before.

Parameters
$id : int
 
$parent : ?AbstractObjectInterface
 

prepareChangesForSave()

protected ObjectManager::prepareChangesForSave (
array $changed,
array $fieldsConfig
): array
Parameters
$changed : array
 
$fieldsConfig : array
 
Exceptions

Throws \com\setasign\Konquadrat\Exception

prepareHistoryChanges()

protected ObjectManager::prepareHistoryChanges (
array $initialData,
array $changed,
array $fieldsConfig,
bool $force = false
): array
Parameters
$initialData : array
 
$changed : array
 
$fieldsConfig : array
 
$force : bool
 

saveExisting()

protected ObjectManager::saveExisting (
AbstractObject $object,
bool $force = false
): array
Parameters
$object : AbstractObject
 
$force : bool
 
Exceptions

Throws \Throwable

saveNew()

protected ObjectManager::saveNew (
AbstractObject $object
): array
Parameters
$object : AbstractObject
 
Exceptions

Throws \Throwable

setLogger()

public ObjectManager::setLogger (
\Psr\Log\LoggerInterface $logger
): void

Sets a logger instance on the object.

Parameters
$logger : \Psr\Log\LoggerInterface
 

updatePath()

protected ObjectManager::updatePath (
int $id,
?AbstractObject $parent
): void

We update all child paths!

Parameters
$id : int
 
$parent : ?AbstractObject