pivots
Table of Contents
Functions
- customerKey() : null|int|string
- Returns the customer organization key an authenticated account is a contact for.
- customerKeys() : array<int, int|string>
- Returns every customer organization key an authenticated account is a contact for.
- sellerKey() : null|int|string
- Returns the seller key of an authenticated account.
- sellerKeys() : array<int, int|string>
- Returns every seller key of an authenticated account.
Functions
customerKey()
Returns the customer organization key an authenticated account is a contact for.
customerKey(User $user) : null|int|string
Resolves the account's first CustomerEmployee business identity and
returns the _key of the organization it works for (subject.worksFor) — the
pivot used to scope a customer contact's resources (e.g. invoices or pricing
conditions of that customer). A contact works for a single customer, so a
single key is returned.
Parameters
- $user : User
-
The authenticated account, with its
identitieshydrated.
Tags
Return values
null|int|string —The customer organization _key, or null when the
account has no customer-contact identity.
customerKeys()
Returns every customer organization key an authenticated account is a contact for.
customerKeys(User $user) : array<int, int|string>
Resolves all CustomerEmployee business identities of the account and
returns, for each, the _key of the organization it works for
(subject.worksFor) — the multi-valued pivot used to scope the resources of
the customer(s) an account represents (e.g. the products priced for them). An
account may be the contact of several customer organizations (e.g. the manager
of two companies); this is the plural counterpart of customerKey().
Parameters
- $user : User
-
The authenticated account, with its
identitieshydrated.
Tags
Return values
array<int, int|string> —The customer organization _key list
(deduplicated, never null entries), or an empty array when the account has no
customer-contact identity.
sellerKey()
Returns the seller key of an authenticated account.
sellerKey(User $user) : null|int|string
Resolves the account's first Seller business identity and returns its
subject _key — the pivot used to scope a salesperson's own resources
(e.g. the customers whose assignedSeller._key matches it).
Parameters
- $user : User
-
The authenticated account, with its
identitieshydrated.
Tags
Return values
null|int|string —The seller _key, or null when the account has no
seller identity.
sellerKeys()
Returns every seller key of an authenticated account.
sellerKeys(User $user) : array<int, int|string>
Resolves all Seller business identities of the account and returns
their subject _key — the multi-valued pivot used to scope a salesperson's
own resources (e.g. the customers whose seller is one of these keys). An
account may wear several seller hats; this is the plural counterpart of
sellerKey().
Parameters
- $user : User
-
The authenticated account, with its
identitieshydrated.
Tags
Return values
array<int, int|string> —The seller _key list (deduplicated, never null
entries), or an empty array when the account has no seller identity.