protected static function getOrgs(array $conditions = NULL) { if (empty($conditions) || !array_key_exists('orgName', $conditions)) { return devconnect_multiorg_get_configured_orgs(); } try { $orgs = array(devconnect_multiorg_find_requested_org($conditions['orgName'])); } catch (Exception $e) { watchdog('devconnect_multiorg', 'Invalid requested org “@orgName”; returning default instead', array('@orgName' => $conditions['orgName']), WATCHDOG_WARNING); $orgs = array('default'); } return $orgs; }
/** * Updates the email address associated with a developer. * * By default, we do not support changing the developer's email address on * the user-profile form -- we disable the element. However, customer- * specific code may do so, hence this function. * * @param \Drupal\devconnect_user\DeveloperEntity $entity * The entity whose email address is to be changed. * @param string $new_email * The new email to be assigned to this entity. * * @return bool * TRUE on success, FALSE on failure. */ public function updateEmail(DeveloperEntity $entity, $new_email) { $saved = FALSE; if (empty($entity->orgNames)) { $entity->orgNames = array('default'); } foreach ($entity->orgNames as $org) { if (module_exists('devconnect_multiorg')) { $org = devconnect_multiorg_find_requested_org($org); } $config = devconnect_default_org_config($org); try { $dev = new Developer($config); $dev->load($entity->developerId); $dev->setEmail($new_email); $dev->save(TRUE, $entity->email); $saved = TRUE; $this->devCache[$entity->developerId] = $dev; $entity->email = $new_email; } catch (Exception $e) { watchdog('devconnect_user', 'Error updating the developer email: %response_message', array('%response_message' => $e->getMessage()), WATCHDOG_ERROR); } } return $saved; }