Skip to content

Instantly share code, notes, and snippets.

View Trench94's full-sized avatar

Luke Marshall Trench94

  • Newcastle Upon Tyne
View GitHub Profile
@Trench94
Trench94 / BookingManager.php
Last active April 22, 2022 16:46
BookingManager class code review
<?php
/**
* The following code will be published to a production server.
*
* It's a simple script that allows a customer to view their booking status.
*
* Find as many errors or flaws as you can. You can edit the code inline, and/or
* leave a comment where you think you've found a flaw.
*/
/**
* Update the Drupal user with new team id
*/
public function updateUserTeam($username, $team_id) {
//Load user
$user = \Drupal::entityTypeManager()->getStorage('user')->loadByProperties([
'name' => $username,
]);