Differential D25065 Diff 314 src/applications/passphrase/controller/PassphraseCredentialEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/passphrase/controller/PassphraseCredentialEditController.php
Show All 37 Lines | if ($id) { | ||||
$credential = PassphraseCredential::initializeNewCredential($viewer) | $credential = PassphraseCredential::initializeNewCredential($viewer) | ||||
->setCredentialType($type->getCredentialType()) | ->setCredentialType($type->getCredentialType()) | ||||
->setProvidesType($type->getProvidesType()) | ->setProvidesType($type->getProvidesType()) | ||||
->attachImplementation($type); | ->attachImplementation($type); | ||||
$is_new = true; | $is_new = true; | ||||
// Prefill username if provided. | // Prefill username if provided. | ||||
$credential->setUsername((string)$request->getStr('username')); | $credential->setUsername((string)$request->getStr('username')); | ||||
valerio.bozzolan: I honestly don't know why here we use `(string)`. Probably we just want to set an empty default… | |||||
Not Done Inline ActionsI got curios, so I looked it up: https://secure.phabricator.com/D13261#140865 - looks like it's to convert null to '' for the DB schema. I'm not sure if it's still relevant, but there's probably no harm in keeping it. avivey: I got curios, so I looked it up: https://secure.phabricator.com/D13261#140865 - looks like it's… | |||||
// Prefill name if provided. | |||||
$credential->setName((string)$request->getStr('name')); | |||||
// Prefill description if provided. | |||||
$credential->setDescription((string)$request->getStr('description')); | |||||
Done Inline ActionsI honestly don't kno valerio.bozzolan: I honestly don't kno | |||||
if (!$request->getStr('isInitialized')) { | if (!$request->getStr('isInitialized')) { | ||||
$type->didInitializeNewCredential($viewer, $credential); | $type->didInitializeNewCredential($viewer, $credential); | ||||
} | } | ||||
} | } | ||||
$errors = array(); | $errors = array(); | ||||
$v_name = $credential->getName(); | $v_name = $credential->getName(); | ||||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
I honestly don't know why here we use (string). Probably we just want to set an empty default to prevent that case? Anyway I've copy-pasted that switching-off my brain. I have no intention to discuss that now, but it's just nice to mention that I'm confused.