public function setId() { // Reuse key generation from ApiKey entity. $apiKey = new ApiKey(); $apiKey->setId(); $this->id = $apiKey->getId(); }
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(); }