Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model id saving as array #10

Open
fernholz opened this issue Apr 9, 2013 · 6 comments
Open

Model id saving as array #10

fernholz opened this issue Apr 9, 2013 · 6 comments

Comments

@fernholz
Copy link

fernholz commented Apr 9, 2013

For some reason my id is an array with 2 elements, both of which are the correct Id for the Salesforce Entry. Any idea what may be causing that.

Also, I wrote a model generator as we we have super customized and unique salesforce data, it builds properly, but I can't seem to get the data out, even though it is in the queryResult as 'any'. Does anyone have some working sample code so I can see the error of my ways?

Thanks for these awesome bundles, btw.

@ddeboer
Copy link
Owner

ddeboer commented Apr 9, 2013

You're welcome. Can you post some code samples, so we can see what you're trying to accomplish?

@fernholz
Copy link
Author

fernholz commented Apr 9, 2013

object(Ddeboer\Salesforce\MapperBundle\Model\JournalAds)[973]
  protected 'accountBoEBioURLPath' => null
  protected 'accountNumber' => null
  protected 'accountSpokenLanguage' => null
  protected 'accountTeaching' => null
  protected 'accountURLSlug' => null
  protected 'accountWillingToTravel' => null
  protected 'adFirstName' => null
  protected 'adFullName' => null
  protected 'adLanguage' => null
  protected 'adLastName' => null
  protected 'adMiddleName' => null
  protected 'adOrgAccountName' => null
  protected 'adOrganizationName' => null
  protected 'adSuffix' => null
  protected 'adTextAfter' => null
  protected 'adTextBefore' => null
  protected 'adTextOnline' => null
  protected 'adTitle' => null
  protected 'adName' => null
  protected 'advertiserStatus' => null
  protected 'advertiserType' => null
  protected 'afterNameSuffix' => null
  protected 'alsoAvailableData' => null
  protected 'associationLocation' => null
  protected 'beforeAdvertiserName' => null
  protected 'beforeAssociationLocation' => null
  protected 'beforeClassLocation' => null
  protected 'beforeMailingStreet' => null
  protected 'beforePrimaryStreet' => null
  protected 'boLBio' => null
  protected 'boLBioDailyLiftURL' => null
  protected 'boLBioPublish' => null
  protected 'boLBioTitle' => null
  protected 'boLBioVideoLink' => null
  protected 'boLBioWebsite' => null
  protected 'boLHiResHeadshot1' => null
  protected 'boLHiResHeadshot2' => null
  protected 'boLLocation' => null
  protected 'boLLocationDisplay' => null
  protected 'boLOnlineLecture1' => null
  protected 'boLOnlineLecture2' => null
  protected 'boLOnlineLecture3' => null
  protected 'boLOnlineLecture4' => null
  protected 'boLSmallHeadshot' => null
  protected 'boLVideoTitleImage' => null
  protected 'bookmarkID' => null
  protected 'branchNameNumber' => null
  protected 'branchNumber' => null
  protected 'branchNumberAudit' => null
  protected 'cardType' => null
  protected 'classAssocinCombined' => null
  protected 'classLocation' => null
  protected 'compiledAdHours' => null
  protected 'cOPCityState' => null
  protected 'country' => null
  protected 'countryISO' => null
  protected 'countryPhoneCode' => null
  protected 'createdById' => null
  protected 'createdDate' => null
  protected 'cSBBio' => null
  protected 'cSBBioAssociationLanguage' => null
  protected 'cSBBioAssociationLocation' => null
  protected 'cSBBioAssociationTime' => null
  protected 'cSBBioClassCountry' => null
  protected 'cSBBioClassLanguage' => null
  protected 'cSBBioClassLocation' => null
  protected 'cSBBioClassTime' => null
  protected 'cSBBioLecturerProfileURL' => null
  protected 'cSBBioNotes' => null
  protected 'cSBBioOtherContact' => null
  protected 'cSBBioPublish' => null
  protected 'cSBBioWebsite2' => null
  protected 'cSOCityState' => null
  protected 'daysandHours' => null
  protected 'email' => null
  protected 'emailText' => null
  protected 'fullName' => null
  protected 'heraldCountry' => null
  protected 'heraldSortCountry' => null
  protected 'heraldSpokenLanguages' => null
  protected 'heraldStateCodeOverride' => null
  protected 'id' => 
    array
      0 => string 'a1170000000Y0aWAAS' (length=18)
      1 => string 'a1170000000Y0aWAAS' (length=18)
  protected 'iMScreenName' => null
  protected 'iMType' => null
  protected 'isActive' => null
  protected 'isLecturer' => null
  protected 'isDeleted' => null
  protected 'isTeaching' => null
  protected 'journalAdStatus' => null
  protected 'journalAdType' => null
  protected 'lastModifiedById' => null
  protected 'lastModifiedDate' => null
  protected 'latitude' => null
  protected 'longitude' => null
  protected 'mailingAddressDistrict' => null
  protected 'mailingAddressText' => null
  protected 'mailingAddressTextOnline' => null
  protected 'mailingCity' => null
  protected 'mailingCountry' => null
  protected 'mailingMetroRegion' => null
  protected 'mailingStateProvince' => null
  protected 'mailingStreet' => null
  protected 'mailingSubCountry' => null
  protected 'mailingWorldRegion' => null
  protected 'mailingZipPostalCode' => null
  protected 'mailingSortCity' => null
  protected 'mailingSortCountry' => null
  protected 'mailingSortDistrict' => null
  protected 'mailingSortState' => null
  protected 'mailingZip' => null
  protected 'metroRegion' => null
  protected 'militaryBranch' => null
  protected 'militaryTitle' => null
  protected 'name' => null
  protected 'oldCardLine' => null
  protected 'onlineZipPostalCode' => null
  protected 'phone' => null
  protected 'phoneText' => null
  protected 'primaryAddressDistrict' => null
  protected 'primaryAddressText' => null
  protected 'primaryAddressTextOnline' => null
  protected 'primaryAddressType' => null
  protected 'primaryCity' => null
  protected 'primaryContact' => null
  protected 'primaryContactEmail' => null
  protected 'primaryContactPhone' => null
  protected 'primaryCountry' => null
  protected 'primaryEmail' => null
  more elements...

This is 1 of the objects I'm getting back, which indicates the $id issue. The model is huge, I could share a gist with you.

Calling like this -

    $result = $this->get('ddeboer_salesforce_mapper')->findBy(new Model\JournalAds(),
            array(
                'cSBBioPublish' => true
            )
        );

        return $result;

for now I'm just foreaching over the result and dumping in a twig template to get the above output.

@ddeboer
Copy link
Owner

ddeboer commented Apr 9, 2013

I've seen the partner WSDL returning the ID as a duplicated array, as described in the Salesforce help. Are you using a partner or enterprise WSDL?

@fernholz
Copy link
Author

fernholz commented Apr 9, 2013

We are using the partner WSDL, as what we use in a separate integration using pure php and the Salesforce Toolkit.

When I switch to Enterprise WSDL, I get an error.

"Element {}item invalid at this location
500 Internal Server Error - SoapFault"

Stack Trace
in /Users/clarity/Sites/journaldirectory/vendor/ddeboer/salesforce-client-bundle/Ddeboer/Salesforce/ClientBundle/Client.php at line 503

        }
        try {
            $result = $this->soapClient->$method($params);
        } catch (\SoapFault $soapFault) {
            if (null !== $this->eventDispatcher) {
                $event = new Event\SoapFaultEvent($soapFault);

I can pull the whole stack trace if that would be helpful.

@fernholz
Copy link
Author

fernholz commented Apr 9, 2013

And looking at the Salesforce Help link you posted, it would seem that the solution would be to never pass the Id to the query as it is implicitly passed. Perhaps modifying the getQuerySelectPart method on the Mapper Class. Or, more accurately, the getSelect method that implodes all the fields.

@fernholz
Copy link
Author

fernholz commented Apr 9, 2013

Not really related, but when I do a query direct through your Client Bundle, I get records like this

object(Ddeboer\Salesforce\ClientBundle\Response\SObject)[4447]
  public 'Id' => null
  public 'type' => string 'JournalAds__c' (length=13)
  public 'any' => string <huge xml string of all my data>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants