示例#1
0
 public function setId()
 {
     // Reuse key generation from ApiKey entity.
     $apiKey = new ApiKey();
     $apiKey->setId();
     $this->id = $apiKey->getId();
 }
示例#2
0
 private function addKey($em, $user, $label)
 {
     if (empty($label)) {
         return;
     }
     $key = new ApiKey();
     $key->setId();
     $key->setLabel($label);
     $key->setOwner($user);
     $id = $key->getId();
     $credential = $key->setCredential();
     $em->persist($key);
     $this->messenger()->addSuccess('Key created.');
     $this->messenger()->addSuccess("ID: {$id}, Credential: {$credential}");
 }
 /**
  * {@inheritDoc}
  */
 public function getResourceId()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getResourceId', array());
     return parent::getResourceId();
 }