/** * @param LifecycleEventArgs $args */ public function prePersist(LifecycleEventArgs $args) { $user = $args->getEntity(); if (!$this->supports($user)) { return; } $keys = $this->sshKeysGenerator->generate(); $user->setPublicKey($keys['public']); $user->setPrivateKey($keys['private']); }
/** * @param Project $project * * @return boolean */ protected function doKeys(Project $project) { $keys = $this->sshKeysGenerator->generate(); $project->setPublicKey($keys['public']); $project->setPrivateKey($keys['private']); return true; }