Giter Club home page Giter Club logo

Comments (18)

wizardist avatar wizardist commented on June 4, 2024

Hi @ekhlascyblance

Please do composer update - you're using an outdated edge. This issue should have been fixed earlier.

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

ok.
let me try.
then i will tell you.

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

Still Same error

from php-crm-toolkit.

wizardist avatar wizardist commented on June 4, 2024

@ekhlascyblance please provide the full error message again.

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

already provided

from php-crm-toolkit.

wizardist avatar wizardist commented on June 4, 2024

@ekhlascyblance please provide the code that you use to employ the library. It would help a lot.

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

function __construct( Settings $settings, CacheInterface $cache = null, LoggerInterface $logger = null ) {
try {
// Create settings object
$this->settings = $settings;

        // Inject CacheInterface implementation
        $this->cache = $cache;

        // Inject LoggerInterface implementation
        $this->logger = $logger;

        /* If either mandatory parameter is NULL, throw an Exception */
        if ( !$this->checkConnectionSettings() ) {
            switch ( $this->settings->authMode ) {
                case "OnlineFederation":
                    throw new BadMethodCallException( get_class( $this ) . ' constructor requires Username and Password' );
                case "Federation":
                    throw new BadMethodCallException( get_class( $this ) . ' constructor requires the Discovery URI, Username and Password' );
            }
        }
        /* Create authentication class to connect to CRM Online or Internet facing deployment via ADFS */
        switch ( $this->settings->authMode ) {
            case "OnlineFederation":
                $this->authentication = new OnlineFederation( $this->settings, $this );
                break;
            case "Federation":
                $this->settings->loginUrl = $this->getFederationSecurityURI( 'organization' );
                $this->authentication     = new Federation( $this->settings, $this );
                break;
        }
        $this->soapActions = new SoapActions( $this );

        if ( !$this->settings->hasOrganizationData() ) {
            $organizationDetails                    = $this->retrieveOrganization( $this->settings->serverUrl );
            $this->settings->organizationId         = $organizationDetails['OrganizationId'];
            $this->settings->organizationName       = $organizationDetails['FriendlyName'];
            $this->settings->organizationUniqueName = $organizationDetails['UniqueName'];
            $this->settings->organizationVersion    = $organizationDetails['OrganizationVersion'];
        }

        /* Initialize the entity metadata instance */
        MetadataCollection::instance( $this );
    } catch ( Exception $e ) {
        $this->logger->critical( 'Caught an exception while initializing PHP CRM Toolkit.', [ 'exception' => $e ] );
        throw $e;
    }
}

in /src/Client.php

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

My Client setting is as below.
http://prntscr.com/frvjyl

from php-crm-toolkit.

wizardist avatar wizardist commented on June 4, 2024

This is a listing of Client::__construct(), and I would like to see how you are using the library, e.g. including the autoloader, instantiating the client, making calls, etc.

from php-crm-toolkit.

wizardist avatar wizardist commented on June 4, 2024

@ekhlascyblance please change the required version in composer.json - replace the php-crm-toolkit version with dev-master and do composer update. You are using an outdated version at the moment.

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

you mean Like this

{
"require": {
"alexacrm/dev-master": "^1.1"
}
}

from php-crm-toolkit.

wizardist avatar wizardist commented on June 4, 2024

@ekhlascyblance no, please refer to Composer documentation.

Your composer.json file would look like:

{
    "require": {
        "alexacrm/php-crm-toolkit": "dev-master"
    }
}

Then hit the composer update command.

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

ok .

let me try

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

Solved ..
But Got new error now

Class 'Cache' not found

I use below code Note : second Last line

require_once 'vendor/autoload.php';

use AlexaCRM\CRMToolkit\Client as OrganizationService;
use AlexaCRM\CRMToolkit\Settings;

$contactId = '1d2fc62f-1c56-448b-b546-edfb6d6fec5c';
$options = [
'serverUrl' => 'https://org.crmN.dynamics.com',
'username' => '[email protected]',
'password' => 'portalPassword',
'authMode' => 'OnlineFederation',
];

$serviceSettings = new Settings( $options );
$service = new OrganizationService( $serviceSettings );

// retrieve a contact and update its fields
$contact = $service->entity( 'contact', $guid );
$contact->firstname = explode( '@', $contact->emailaddress1 )[0];
$contact->update();
printf( 'Info for %s %s updated.', $contact->firstname, $contact->lastname );

// create a new contact
$contact = $service->entity( 'contact' );
$contact->firstname = 'John';
$contact->lastname = 'Doe';
$contact->emailaddress1 = '[email protected]';
$contactId = $contact->create();

// delete a contact
$contact->delete();

// execute an action
$whoAmIResponse = $service->executeAction( 'WhoAmI' );
echo 'Organization ID: ' . $whoAmIResponse->OrganizationId;

// inject cache repo
// must be instance of AlexaCRM\CRMToolkit\CacheInterface
$cacheRepo = Cache::instance();
$service = new Client( $serviceSettings, $cacheRepo );

from php-crm-toolkit.

wizardist avatar wizardist commented on June 4, 2024

@ekhlascyblance yes, about that - just don't provide a $cacheRepo. Or you can alternatively implement CacheInterface and provide your implementation. This library gives you freedom in this regard.

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

can you please give some example of that CacheInterface implementation.

if i am not wrong it will make response faster.

from php-crm-toolkit.

wizardist avatar wizardist commented on June 4, 2024

CacheInterface and StorageInterface are well documented, and the implementation is trivial. I'm afraid I can't provide you a working example at this time. Some examples may be seen here: https://github.com/AlexaCRM/integration-dynamics/blob/master/src/Cache.php

from php-crm-toolkit.

ekhlascyblance avatar ekhlascyblance commented on June 4, 2024

Ok
Thanks Bro.
You are really wizard for me

from php-crm-toolkit.

Related Issues (20)

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.