Git Product home page Git Product logo

Comments (5)

roblesterjr04 avatar roblesterjr04 commented on July 26, 2024

Some things to note first:

  1. You do not need to include use ... SOQLBuilder; - this is already part of the model.
  2. You should not need to include use App\SalesforceModels... when used in a model that already exists there.
  3. Your opportunity model is referencing Opportunity__c - assuming you are trying to access the standard SFDC Opportunity table, you do not need to use __c and thats probably why you're getting the "resource not found error"

from eloquentsalesforce.

scottgrayson avatar scottgrayson commented on July 26, 2024

@roblesterjr04 1 and 2 I'll remove the extra code
3. Opportunity__c is the correct model. It is a custom table not the standard table

I'm wondering how to access the relations. It works with an SOQL query and it works by using dot notation and nested selects inside the $columns variable. but it does not work using belongsTo belongsToMany

from eloquentsalesforce.

roblesterjr04 avatar roblesterjr04 commented on July 26, 2024

Thats really weird, i use relationships all over the place in my own use, haven't experienced this.

from eloquentsalesforce.

roblesterjr04 avatar roblesterjr04 commented on July 26, 2024

My guess is you probably need to add the foreign keys to the relationships, and make sure any associated foreign/primary keys are included in your column selections.

For example, here's a model I used. I had to specify which column i was using as the foreign key.

<?php

namespace App\SalesForce;

use Lester\EloquentSalesForce\Model;

class AccountTeamMember extends Model
{

    public function account()
    {
        return $this->belongsTo(Account::class, 'AccountId');
    }

}

Where AccountId is the column on AccountTeamMember that references the Id on the Account object.

This is standard Eloquent relationship practice if the column IDs can't be assumed by the framework, which rarely works on Salesforce tables.

from eloquentsalesforce.

roblesterjr04 avatar roblesterjr04 commented on July 26, 2024

Oh I see whats happening now - you're specifying columns, and when you do that, you're basically causing the relationship columns not to be selected, and they are needed. Make sure you are adding those relationship ID columns to the $columns array.

from eloquentsalesforce.

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.