PHPackages                             php-arsenal/safe-salesforce-saver-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. php-arsenal/safe-salesforce-saver-bundle

ActiveSymfony-bundle

php-arsenal/safe-salesforce-saver-bundle
========================================

Allows you to save your objects to Salesforce safely

3.0.0(5y ago)05MITPHPPHP &gt;=7.4

Since Mar 12Pushed 5y agoCompare

[ Source](https://github.com/php-arsenal/safe-salesforce-saver-bundle)[ Packagist](https://packagist.org/packages/php-arsenal/safe-salesforce-saver-bundle)[ Docs](https://github.com/php-arsenal/safe-salesforce-saver-bundle)[ RSS](/packages/php-arsenal-safe-salesforce-saver-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (9)Versions (12)Used By (0)

SafeSalesforceSaver
===================

[](#safesalesforcesaver)

[![Release](https://camo.githubusercontent.com/0be8d392fca10d418ba0edd9bb78143945351120760ed9e92e8d82df8bb002e8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068702d617273656e616c2f736166652d73616c6573666f7263652d73617665722d62756e646c65)](https://github.com/php-arsenal/safe-salesforce-saver-bundle/releases)[![CI](https://camo.githubusercontent.com/b61d5b99fbf9aa4fa257c3632abab6110dfdc4607d9c4fba62fa809b3ebb29fb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7068702d617273656e616c2f736166652d73616c6573666f7263652d73617665722d62756e646c652f4349)](https://github.com/php-arsenal/safe-salesforce-saver-bundle/actions/workflows/ci.yml)[![Packagist](https://camo.githubusercontent.com/7298cb505827a7a3a037c38aa25960d3deead91b6bca28f63fb3032b7863ffef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d617273656e616c2f736166652d73616c6573666f7263652d73617665722d62756e646c65)](https://packagist.org/packages/php-arsenal/safe-salesforce-saver-bundle)

About
-----

[](#about)

With this bundle you can stop worrying about your data getting lost when trying to save information to Salesforce. The SafeSalesforceSaver will take the objects you give it and place them in a queue. The items are taken out of the queue one by one to prevent Salesforce from getting overwhelmed if you decide to save hundreds (or thoussands) of objects at once. If an exception does occur during the save process, rabbit will simply retry the save a few moments later while logging the error away so you can debug what went wrong.

Installation
------------

[](#installation)

`$ composer require php-arsenal/safe-salesforce-saver-bundle`

Depending on your Symfony version you either have to register the bundle in `app/AppKernel.php` (Symfony 3.4 and lower):

```
public function registerBundles()
{
    $bundles = [
        new PhpArsenal\SafeSalesforceSaverBundle\SafeSalesforceSaverBundle(),
    ];

    return $bundles;
}
```

Or (Symfony 4.0 and higher) in your `config/bundles.php`:

```
return [
     PhpArsenal\SafeSalesforceSaverBundle\SafeSalesforceSaverBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

To get this bundle to work you will have to start the queues in your rabbit client. To do this you have to add the following configuration to your projects config.yml:

```
old_sound_rabbit_mq:
    producers:
        sss_async_processor:
            class: PhpArsenal\SafeSalesforceSaverBundle\Producer\AsyncSfSaverProducer
            connection: default
            exchange_options:
                name: 'sss_async_queue'
                type: direct
    consumers:
        sss_async_processor:
            connection: default
            exchange_options:
                name: 'sss_async_queue'
                type: direct
            queue_options:
                name: 'sss_async_queue'
            qos_options:
                prefetch_size: 0
                prefetch_count: 1
                global: false
            callback: PhpArsenal\SafeSalesforceSaverBundle\Consumers\AsyncSfSaveConsumer
    rpc_clients:
        parallel:
            connection: default
            expect_serialized_response: false
    rpc_servers:
        safe_salesforce_saver_server:
            connection: default
            callback: PhpArsenal\SafeSalesforceSaverBundle\Consumers\SafeSalesforceSaverServer
            qos_options: { prefetch_size: 0, prefetch_count: 1, global: false }
            queue_options: { name: sss_rpc_queue, durable: true, auto_delete: false }
```

It is important that you do not change the names of the queues as this could lead to issues. The above configuration assumes that you already have the default configuration for rabbitMQ set up. If not, please refer to the readme file of the [rabbit bundle on github](https://github.com/php-amqplib/RabbitMqBundle).

In order to actually save your objects to Salesforce they have to be annotated in the right way. See [the mapper bundle on github](https://github.com/php-arsenal/salesforce-mapper-bundle).

When you have updated your configuration and models you can save them in two different ways. Synchronous or a-synchronous:

```
