PayPal\Api\PatchRequest::addPatch PHP Méthode

addPatch() public méthode

Append Patches to the list.
public addPatch ( Patch $patch )
$patch Patch
    public function addPatch($patch)
    {
        if (!$this->getPatches()) {
            return $this->setPatches(array($patch));
        } else {
            return $this->setPatches(array_merge($this->getPatches(), array($patch)));
        }
    }

Usage Example

Exemple #1
0
 /**
  * Update existing billing agreement at paypal
  * @param $agreementId
  * @param array $params
  * @return bool
  * @internal param object $createdAgreement Agreement
  */
 function update($agreementId, $params)
 {
     $patch = new Patch();
     $patch->setOp('replace')->setPath('/')->setValue($params);
     $patchRequest = new PatchRequest();
     $patchRequest->addPatch($patch);
     try {
         $agreement = Agreement::get($agreementId, $this->getAdapter()->getApiContext());
         $agreement->update($patchRequest, $this->getAdapter()->getApiContext());
     } catch (\Exception $ex) {
         //@todo add some logging
     }
     return true;
 }
All Usage Examples Of PayPal\Api\PatchRequest::addPatch