Created
February 26, 2016 23:12
-
-
Save ABM-Dan/126ce72a698fc829e72e to your computer and use it in GitHub Desktop.
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 | |
// 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