This commit is contained in:
Dennis Eichhorn 2018-12-08 21:48:43 +01:00
parent b90f14c690
commit 91e3f6939e
2 changed files with 20 additions and 4 deletions

View File

@ -49,9 +49,7 @@ final class ApiController extends Controller
$created = [];
foreach ($profiles as $profile) {
$this->app->eventManager->trigger('PRE:Module:Admin-profile-create', '', $profile);
ProfileMapper::create($profile);
$this->app->eventManager->trigger('POST:Module:Admin-profile-create', '', $profile);
$this->apiProfileCreateDbEntry($profile);
$created[] = $profile->jsonSerialize();
}
@ -64,6 +62,24 @@ final class ApiController extends Controller
]);
}
/**
* @param Profile $profile Profile to create in the database
*
* @return void
*
* @since 1.0.0
*/
public function apiProfileCreateDbEntry(Profile $profile) : void
{
$this->app->eventManager->trigger('PRE:Module:Admin-profile-create', '', $profile);
ProfileMapper::create($profile);
$this->app->eventManager->trigger('POST:Module:Admin-profile-create', '', [
$profile->getAccount()->getId(),
null,
$profile,
]);
}
/**
* Method to create profile from request.
*

View File

@ -29,7 +29,7 @@ use phpOMS\Stdlib\Base\Location;
* @link http://website.orange-management.de
* @since 1.0.0
*/
class Profile
class Profile implements \JsonSerializable
{
/**
* Id.