Skip to content

Instantly share code, notes, and snippets.

@ABM-Dan
Created February 26, 2016 23:12
Show Gist options
  • Save ABM-Dan/126ce72a698fc829e72e to your computer and use it in GitHub Desktop.
Save ABM-Dan/126ce72a698fc829e72e to your computer and use it in GitHub Desktop.
<?php
// in the controller
$user = Customer::isCustomer($this->getUser());
// in the entity
/**
* @param UserInterface $user
*
* @return Customer|null
*/
public static function isCustomer($user)
{
if ($user instanceof Customer){
return $user;
} else {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment