private function validatePolicyTransaction(PhabricatorLiskDAO $object, array $xactions, $transaction_type, $capability)
 {
     $actor = $this->requireActor();
     $errors = array();
     // Note $this->xactions is necessary; $xactions is $this->xactions of
     // $transaction_type
     $policy_object = $this->adjustObjectForPolicyChecks($object, $this->xactions);
     // Make sure the user isn't editing away their ability to $capability this
     // object.
     foreach ($xactions as $xaction) {
         try {
             PhabricatorPolicyFilter::requireCapabilityWithForcedPolicy($actor, $policy_object, $capability, $xaction->getNewValue());
         } catch (PhabricatorPolicyException $ex) {
             $errors[] = new PhabricatorApplicationTransactionValidationError($transaction_type, pht('Invalid'), pht('You can not select this %s policy, because you would no longer ' . 'be able to %s the object.', $capability, $capability), $xaction);
         }
     }
     if ($this->getIsNewObject()) {
         if (!$xactions) {
             $has_capability = PhabricatorPolicyFilter::hasCapability($actor, $policy_object, $capability);
             if (!$has_capability) {
                 $errors[] = new PhabricatorApplicationTransactionValidationError($transaction_type, pht('Invalid'), pht('The selected %s policy excludes you. Choose a %s policy ' . 'which allows you to %s the object.', $capability, $capability, $capability));
             }
         }
     }
     return $errors;
 }