Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions EventListener/ObjectUploadSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function getSubscribedEvents()
{
return array(
Events::preFlush,
Events::prePersist,
Events::postPersist,
Events::postUpdate,
Events::postFlush,
Expand All @@ -85,6 +86,19 @@ public function preFlush(PreFlushEventArgs $args)
}
}

/**
* Prepares upload file references for a new object implementing the UploadObjectInterface.
*
* @param LifecycleEventArgs $args
*/
public function prePersist(LifecycleEventArgs $args)
{
$object = $args->getObject();
if ($object instanceof UploadObjectInterface) {
$this->prepareUploadFileReferences($object);
}
}

/**
* Stores the file uploads.
*
Expand Down