CoolCMS API

Seller extends Seller
in package

Seller (`cms_mod_invoicer_sellers`): `name`, `countryCode` plus owned collections of contacts (without `userType`), bank accounts and VAT status history (multiplier, full-replace object-graph save).

Also used in picker mode by the invoice form.

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_invoicer_sellers'
#[TableAlias]
'seller'

Table of Contents

Properties

$bankAccounts  : Collection
$contacts  : Collection
$countryCode  : string
$id  : int|null
$name  : string|null
$taxStatuses  : Collection
$userTypeId  : int|null
$useVat  : bool

Methods

__construct()  : mixed
addBankAccount()  : $this
addContact()  : $this
bankAccountCollectionInit()  : void
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
clearBankAccounts()  : $this
clearContacts()  : $this
contactCollectionInit()  : void
findTaxStatusOn()  : SellerTaxStatus|null
Status valid on `$date` = the row with the newest `validFrom <= date`; null = no row that early (or no history at all — tell the two apart with `getTaxStatuses()->isEmpty()`).
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getBankAccount()  : TBankAccount|null
getBankAccounts()  : Collection<int, TBankAccount>
getContact()  : TContact|null
getContacts()  : Collection<int, TContact>
getCountryCode()  : string
getId()  : int|null
getName()  : string|null
getTaxStatuses()  : Collection<int, SellerTaxStatus>
getUserTypeId()  : int|null
User type of the seller.
getUseVat()  : bool
Flat `use_vat` mirror, not the VAT mode of a document. Use {@see resolveUseVatOn()} on an entity loaded with `taxStatuses`, or `SellerManager::resolveUseVatOn()` in the Api layer.
isPersisted()  : bool
removeBankAccount()  : $this
removeContact()  : $this
resolveUseVatOn()  : bool|null
"Charges VAT" on `$date` (payer → true, identified / non-payer → false) from the loaded status history. No history at all = the flat `use_vat` safety net; history that starts later = null (status missing on that date — the caller decides). Requires the `taxStatuses` include.
setBankAccounts()  : $this
setContacts()  : $this
setCountryCode()  : TBankAccount>
setId()  : $this
setName()  : $this
setTaxStatuses()  : static
Accepts any Collection — the Api SaveTrait copies a managed PersistentCollection through the setter.
setUserTypeId()  : TBankAccount>
setUseVat()  : TBankAccount>
taxStatusCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$bankAccounts

protected Collection $bankAccounts
Attributes
#[CollectionOf]
\App\UI\Admin\Invoicer\Models\Entities\SellerBankAccount::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Invoicer\Models\Entities\SellerBankAccount::class
$mappedBy: 'seller'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

$contacts

protected Collection $contacts
Attributes
#[CollectionOf]
\App\UI\Admin\Invoicer\Models\Entities\SellerContact::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Invoicer\Models\Entities\SellerContact::class
$mappedBy: 'seller'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

$countryCode

protected string $countryCode = 'CZ'
Attributes
#[Column]
$name: 'country_code'
$type: 'string'
$length: 2
$options: ['fixed' => true, 'default' => 'CZ']

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'seller_id'
$type: 'integer'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$name

protected string|null $name = null
Attributes
#[Column]
$name: 'name'
$type: 'string'
$length: 255
$nullable: true

$taxStatuses

protected Collection $taxStatuses
Attributes
#[CollectionOf]
\App\UI\Admin\Invoicer\Models\Entities\SellerTaxStatus::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Invoicer\Models\Entities\SellerTaxStatus::class
$mappedBy: 'seller'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

$userTypeId

protected int|null $userTypeId = null
Attributes
#[Column]
$name: 'cms_system_user_types_user_type_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$useVat

protected bool $useVat = false
Attributes
#[Column]
$name: 'use_vat'
$type: 'boolean'
$options: ['default' => false]

Methods

__construct()

public __construct([int|null $id = null ][, string|null $name = null ][, string $countryCode = 'CZ' ][, bool $useVat = false ][, int|null $userTypeId = null ][, Collection $contacts = new ArrayCollection() ][, Collection $bankAccounts = new ArrayCollection() ][, Collection $taxStatuses = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$name : string|null = null
$countryCode : string = 'CZ'
$useVat : bool = false
$userTypeId : int|null = null
$contacts : Collection = new ArrayCollection()
$bankAccounts : Collection = new ArrayCollection()
$taxStatuses : Collection = new ArrayCollection()

addBankAccount()

public addBankAccount(TBankAccount $bankAccount) : $this
Parameters
$bankAccount : TBankAccount
Return values
$this

addContact()

public addContact(TContact $contact) : $this
Parameters
$contact : TContact
Return values
$this

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

findTaxStatusOn()

Status valid on `$date` = the row with the newest `validFrom <= date`; null = no row that early (or no history at all — tell the two apart with `getTaxStatuses()->isEmpty()`).

public findTaxStatusOn(DateTimeInterface $date) : SellerTaxStatus|null
Parameters
$date : DateTimeInterface
Return values
SellerTaxStatus|null

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getBankAccount()

public getBankAccount(int $bankAccountId) : TBankAccount|null
Parameters
$bankAccountId : int
Return values
TBankAccount|null

getBankAccounts()

public getBankAccounts() : Collection<int, TBankAccount>
Return values
Collection<int, TBankAccount>

getContact()

public getContact(int $contactId) : TContact|null
Parameters
$contactId : int
Return values
TContact|null

getContacts()

public getContacts() : Collection<int, TContact>
Return values
Collection<int, TContact>

getCountryCode()

public getCountryCode() : string
Return values
string

getName()

public getName() : string|null
Return values
string|null

getUserTypeId()

User type of the seller.

public getUserTypeId() : int|null
Return values
int|null

getUseVat()

Flat `use_vat` mirror, not the VAT mode of a document. Use {@see resolveUseVatOn()} on an entity loaded with `taxStatuses`, or `SellerManager::resolveUseVatOn()` in the Api layer.

public getUseVat() : bool
Return values
bool

removeBankAccount()

public removeBankAccount(TBankAccount $bankAccount) : $this
Parameters
$bankAccount : TBankAccount
Return values
$this

removeContact()

public removeContact(TContact $contact) : $this
Parameters
$contact : TContact
Return values
$this

resolveUseVatOn()

"Charges VAT" on `$date` (payer → true, identified / non-payer → false) from the loaded status history. No history at all = the flat `use_vat` safety net; history that starts later = null (status missing on that date — the caller decides). Requires the `taxStatuses` include.

public resolveUseVatOn(DateTimeInterface $date) : bool|null
Parameters
$date : DateTimeInterface
Return values
bool|null

setBankAccounts()

public setBankAccounts(Collection<int, TBankAccount>|array<int, TBankAccount> $bankAccounts) : $this
Parameters
$bankAccounts : Collection<int, TBankAccount>|array<int, TBankAccount>
Return values
$this

setContacts()

public setContacts(Collection<int, TContact>|array<int, TContact> $contacts) : $this
Parameters
$contacts : Collection<int, TContact>|array<int, TContact>
Return values
$this

setCountryCode()

public setCountryCode(string $countryCode) : TBankAccount>
Parameters
$countryCode : string
Return values
TBankAccount>

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setName()

public setName(string|null $name) : $this
Parameters
$name : string|null
Return values
$this

setUserTypeId()

public setUserTypeId(int|null $userTypeId) : TBankAccount>
Parameters
$userTypeId : int|null
Return values
TBankAccount>

setUseVat()

public setUseVat(bool $useVat) : TBankAccount>
Parameters
$useVat : bool
Return values
TBankAccount>

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results