MMOframework
Why AI Playground Libraries Documentation Search Agency
FR EN
Index

Attach

MMO\edms\events · 1 symbol · generated 27 Oct 2026

class

Attach

Attach.php:26
A client attaches a file to an entity of the application (an upload's `attachment`), or looks at the files attached to it: edms cannot know who may, the application answers, for an $action: - [`Access::CREATE`](https://mmoframework.fr/en/documentation/mmo.edms/php/helpers/Access.md#access-create) attach a file to it. Nobody answering lets it; a listener answering false refuses it (a 403).class MMO\edms\events\Attach extends MMO\core\events\Signal
Namespace
MMO\edms\events
Extends
Signal
Answering true also lets the client put the file in a global tag (`_TAGS/...`) that no scope gives it: on a record, a global tag is one of its rubrics ([`FileManager::canLabel`](https://mmoframework.fr/en/documentation/mmo.edms/php/FileManager.md#filemanager-canlabel)); - [`Access::SHOW`](https://mmoframework.fr/en/documentation/mmo.edms/php/helpers/Access.md#access-show) see the files attached to it that carry a global tag, which no scope gives it ([`FileManager::can`](https://mmoframework.fr/en/documentation/mmo.edms/php/FileManager.md#filemanager-can)). Only a listener answering true lets it. A scope set on the file or on the label always wins over the answer.
Attach::AddListener(function (Attach $event): void { if (($event->entity instanceof Invoice) && (!$event->entity->isEditableBy($event->client))) {$event->setReturn(false);} }); //whoever sees a record sees the documents of its rubrics, and adds some Attach::AddListener(fn (Attach $event) => $event->setReturn(canSee($event->client, $event->entity)));

Properties3

action

readonly
readonly string $action
Type
string

client

readonly
readonly MMO\oauth\interfaces\iClient $client
Type
iClient

entity

readonly
readonly MMO\core\interfaces\iEntity $entity
Type
iEntity

Methods3

isAllowed()

Attach.php:32
function isAllowed(): bool
returnsbooltrue unless a listener refused it

isGranted()

Attach.php:37
function isGranted(): bool
returnsbooltrue if a listener said yes: what grants a right that no scope gives

__construct($origin, $client, $entity, $action)

Attach.php:27
function __construct( object|string $origin, MMO\oauth\interfaces\iClient $client, MMO\core\interfaces\iEntity $entity, string $action = MMO\edms\helpers\Access::CREATE )
$originobject | string
$clientiClient
$entityiEntity
$action = MMO\edms\helpers\Access::CREATEstring
Inherited members (16)
PropertiesDeclared byDescription
ListenersEvent
originEvent
returnValueSignal
MethodsDeclared byDescription
AddListener($handler, $order)EventRegister a listener directly (as opposed to ConnectListeners's attribute-based discovery).
ConnectListeners($obj)EventScan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class.
DisconnectListeners($obj)EventUndo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class.
dispatch()EventInvoke every GetListeners listener with $this.
GetListeners()EventCollect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep …
getOrigin()Event
getReturn()Signal
HasListener($handler)Event
hasReturn()Signal
RemoveListener($handler)EventRemove the last added handler from the listeners.
Send($args)EventConstruct a new instance of this class with $args, then dispatch it to every listener.
SetListenerOrder($handler, $order)EventChange the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here).
setReturn($value, $stop)Signal