Git Product home page Git Product logo

trineforce's People

Contributors

allcontributors[bot] avatar dependabot-preview[bot] avatar dependabot[bot] avatar eher avatar malukenho avatar peter279k avatar renovate[bot] avatar rodrigoaguilera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

trineforce's Issues

Fix examples in readme.md

I have been trying to use the examples to make my own queries but I haven't been able to use them verbatim.

If I try

        $stmt = $this->connection->createQueryBuilder()
            ->select(['AccountId', 'Name'])
            ->from('Contact')
            ->where('AccountId = :id')
            ->setParameter('id', '0013Y00002ZZLOzQAP')
            ->setMaxResults(1);

I get the following invalid SOQL query

SELECT AccountId, Name FROM Contact WHERE AccountId = :'0013Y00002ZZLOzQAP' LIMIT 1

Notice the colon before the AccountId string.
To get a proper SOQL query I need to use ->setParameter(':id', '0013Y00002ZZLOzQAP') with the colon.

Also trying to use positional parameters it seems like the index starts at 1 for positional parameter because of the use of
Doctrine\DBAL\Driver\OCI8\ConvertPositionalToNamedPlaceholders; in the SoqlStatement class.

When I read the docs the positional parameters usually start at 0 but not for this driver.
https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/query-builder.html

Is there a reason why there is a custom logic in this driver around parameters?

I'm not proposing a change in the readme yet because first I want to clarify the reasoning behind the current code.

Congratulations on a great piece of software.

Explore compatibility with the Doctrine ORM.

I would be great to define ORM objects that are configured to use this driver in the backend.

I have been researching this a bit and one of the initial obstacle is the lack of support for aliasing fields/columns in a SOQL query aka AS.

Has anyone tried before?

List alternative packages in the documentation

Summary

I was very happy to find this library on packagist to develop a salesforce integration but before that I stumbled upon
https://github.com/Kephson/php-salesforce-rest-api
that is not a a DBAL

Trineforce fits more my project needs and I don't have to worry about sanitizing the parameters for the queries since that is done by doctrine.

I also discovered an eloquent model for salesforce
https://github.com/roblesterjr04/EloquentSalesForce
but I don't want to use laravel for this particular project.

Describe the solution you'd like

My main goal is to make people aware of the alternatives so even if only the maintainer reads this issue is fine but I think it can be beneficial to have a little section in the readme that lists alternatives. I will propose the same on the other packages.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php ^8.1 || ^8.2
  • azjezz/psl ^2.7.0
  • doctrine/dbal ^3.6.6
  • doctrine/orm ^3.0.0
  • guzzlehttp/guzzle ^7.8.0
  • guzzlehttp/psr7 ^2.6.1
  • psr/http-message 2.0
  • doctrine/coding-standard ^12.0.0
  • infection/infection ^0.27.0
  • maglnet/composer-require-checker ^4.6.0
  • malukenho/mcbumpface ^1.2.0
  • phpunit/phpunit ^10.3.3
  • staabm/annotate-pull-request-from-checkstyle ^1.8.5
github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • shivammathur/setup-php v2
.github/workflows/release-on-milestone-closed.yml
  • actions/checkout v4
  • laminas/automatic-releases v1
  • laminas/automatic-releases v1
  • ubuntu 22.04

  • Check this box to trigger a request for Renovate to run again on this repository

Make it possible to consume a sObject via GET request

As of today, we cannot consume a sObject without doing a SOQL query. But it still relevant to have a GET request to specific resources, as SOQL doesn't support * when querying fields, and via direct resource consumption we can grab all data related to a resource.

The Hacky way to do it right now is to get the configured GuzzleHttpClient and do the call directly.

$httpClient = $this->connection
    ->getWrappedConnection()
    ->getHttpClient();

$request    = $httpClient->request(
    'GET',
    sprintf('/services/data/v40.0/sobjects/Opportunity/%s', $id)
);

Results of join queries should be countable

        $result = $this->connection
                       ->createQueryBuilder()
                       ->select(['Id'])
                       ->from('Account')
                       ->join('Opportunities', ['Id'])
                       ->where('ExternalId__c' = :externalId')
                       ->setParameter('externalId', $externalId)
                       ->execute()
                       ->fetchAll();

        var_dump($result);

This is the current result

 array(1) {
   [0]=>
   array(2) {
     ["Id"]=>
     string(18) "001w000001jEKBUMBA"
     ["Opportunities"]=>
     NULL
   }
 }

To be able to use count should be something like this

 array(1) {
   [0]=>
   array(2) {
     ["Id"]=>
     string(18) "001w000001jEKBUMBA"
     ["Opportunities"]=> []
   }
 }

Special url characters not used in Soql

When parameter contains url special character it's ignored in Soql:
`$phone = '+31612345678';

$sql = $conn->createQueryBuilder()
->select(['Contact.name','Contact.phone','Account.id', 'Account.name', 'Owner.email', 'Owner.name', 'Owner.id'])
->from('Contact')
->where('Phone = :phone')
->setParameter('phone', $phone, 'string')
->setMaxResults(1)
->execute();`

No results.

With urlencode in do_fetch
/** @return mixed[]|false */ private function doFetch() { // TODO: how to deal with different versions? MaybedriverOptions`?
$request = $this->connection->get('/services/data/v20.0/query?q=' . urlencode($this->statement));

    return json_decode($request->getBody()->getContents(), true);
}

`

One result

The Result constructor should not be extended in Codelicia\Soql\DBAL\Result

When clearing the cache of my app I get:

[info] User Deprecated: The "Doctrine\DBAL\Result::__construct()" method is considered internal The result can be only instantiated by {@see Connection} or {@see Statement}. It may change without further notice. You should not extend it from "Codelicia\Soql\DBAL\Result".

Fix issue when submitting queries through transactions

We have: private const SERVICE_COMPOSITE_URL = '/services/data/%s/composite';

But when used, "SERVICE_COMPOSITE_URL" is missing the tag replacement to have the API version actually inserted, which results in an invalid URL.

Handler array types when bind parameters

The following code should work out of the box

$this->client
            ->createQueryBuilder()
            ->select([
                'Id'
            ])
            ->from('Case')
             ->where('RecordType.Name IN (:recordTypeNames)')
            ->setParameter(
                'recordTypeNames',
                ['a', 'b', 'third' => 'c'],
                Types::TArray
            )
            ->execute()
            ->fetch();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.