/** * Determines, if the given object is of type Customer and if it is related to the contract. * * @param Contract $contract The current contract identified by provided the access token. * @param mixed $object The object to be handled * * @return bool */ protected function grantByCustomer(Contract $contract, $object) { if ($object instanceof \GravitonDyn\CustomerBundle\Document\Customer) { return $contract->getCustomer() == $object; } return false; }
/** * Returns the username used to authenticate the user. * * @return string The username */ public function getUsername() { return sprintf("%s %s", $this->contract->getCustomer()->getFirstname(), $this->contract->getCustomer()->getLastname()); }