Created
December 10, 2019 00:35
-
-
Save ivastly/5d158b8e27f4facd731544a081e91c9d to your computer and use it in GitHub Desktop.
Crosscutting conserns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function createNewUser($newUsername) | |
{ | |
$start = time(); // load time calculation | |
if (!$this->isGranted('ROLE_ADMIN')) // access control | |
{ // access control | |
throw new AccessDeniedException(); // access control | |
} // access control | |
$this->logger->info("Creating new user {$newUsername}"); // logging | |
$user = new User(); | |
$user->setName($newUsername); | |
$this->entityManager->persist($user); | |
$this->entityManager->flush(); | |
$this->logger->info("User {$newUsername} was created"); // logging | |
$totalTime = time() - $start; // load time calculation | |
header("X-Create-User-Total-Time: $totalTime sec"); // load time calculation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment