Download the PHP package codelicia/trineforce without Composer
On this page you can find all versions of the php package codelicia/trineforce. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codelicia/trineforce
More information about codelicia/trineforce
Files in codelicia/trineforce
Package trineforce
Short Description Salesforce Soql Doctrine Driver
License MIT
Homepage https://github.com/codelicia/
Informations about the package trineforce
SOQL Doctrine DBAL
Salesforce Soql Doctrine Driver allows you to write Soql queries and interact with a Salesforce instance using the Doctrine DBAL layer.
Now one can forget about Salesforce and have a nice repository/query object
integration on one's architecture without hurting that much on the usual
project structure.
Installation
Use composer to install this package as bellow:
Configuration
If you are familiar with Doctrine, then you probably already know how to configure and use it. But some special configuration is required in order to make it work.
When creating a new Connection, you should also provide the configuration
keys for salesforceInstance, consumerKey, consumerSecret and point to
the right driverClass. The usual user and password are also required.
userprovides the login, which is usually an email to access the salesforce instance.passwordprovides the corresponding password to the email provided onuser.salesforceInstancepoints to the url of the Salesforce instance.apiVersionspecify a salesforce API version to work with.consumerKeyprovides the integration consumer keyconsumerSecretprovides the integration consumer secretdriverClassshould points to\Codelicia\Soql\SoqlDriver::classwrapperClassshould points to\Codelicia\Soql\ConnectionWrapper::class
By setting up the wrapperClass, we can make use of a proper QueryBuild that allow
JOIN in the Salesforce format.
When using the doctrine bundle and the dbal is configured through yaml the options should be passed in a different way for the validation that the bundle does.
Using DBAL
Now that you have the connection set up, you can use Doctrine QueryBuilder to
query some data as bellow:
or use the normal Connection#query() method.
Basic Operations
Here are some examples of basic CRUD operations.
Connection#insert()
Creating an Account with the Name of John:
Connection#delete()
Deleting an Account with the Id = 1234:
Connection#update()
Update an Account with the Name of Sr. John where the Id is 1234:
Be Transactional with Composite API
As salesforce released the composite api, it gave us the ability
to simulate transactions as in a database. So, we can use the same
Doctrine DBAL api that you already know to do transactional operations
in your Salesforce instance.
Or even, use the Connection#transactional() helper, as you prefer.
Referencing another Records
The composite api, also enables us to compose a structure data to be
changed in one single request. So we can cross reference records as it
fits our needs.
Let's see how to create an Account and a linked Contact to that Account
in a single composite request.
🚫 Known Limitations
As of today, we cannot consume a sObject using the queryBuilder to get all fields from
the sObject. That is because Salesforce doesn't accept SELECT * as a valid query.
The workaround that issue is to do a GET request to specific resources, then can grab all
data related to that resource.
📈 Diagram
Author
- Jefersson Nathan (@malukenho)
- Alexandre Eher (@Eher)
All versions of trineforce with dependencies
ext-json Version *
ext-pdo Version *
beberlei/assert Version ^v3.3.2
doctrine/dbal Version ^3.5.1
doctrine/orm Version ^2.13.3
guzzlehttp/guzzle Version ^6.0 | ^7.0
guzzlehttp/psr7 Version ^2.4.3
psr/http-message Version ^1.0.1