Complaint
extends BaseEntity
in package
implements
OwnerAwareInterface, IdentifiableInterface
uses
IdentifiableTrait, UserAssociationOwnerTrait
Complaint aggregate. The state is a single FK to {@see ComplaintStatus}, with no separate enum column.
order is a reference (SET NULL, like OrderItem::$productSet): deleting the order does
not invalidate the complaint, hence the additional customer* snapshot (the customer at the
time the complaint was received, independent of order and user).
Owned collections (cascade persist/remove, orphan removal in leaves): items (one row per
complained item, ComplaintItem) and files (attachments, ComplaintFileRel,
a rel to the shared System File like Bazaar AdvertFileRel; AssetPathTrait does not fit
because it stores a single path per entity). A save replaces the collections in full.
stockDocumentId is a reference only (no FK, foreign Store module, same as
Order::$stockDocumentId); the stock return
(ComplaintStockManager) writes it after a
successful DocumentService::receive().
Tags
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'complaint'
Table of Contents
Interfaces
- OwnerAwareInterface
- Entity that knows who created it (the owner is the author or sender of the record); the named entry point to the generic base of the conditional RBAC role `owner`.
- IdentifiableInterface
- Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).
Properties
- $adminNote : string|null
- $customerCity : string|null
- $customerEmail : string|null
- $customerFirstname : string|null
- $customerLastname : string|null
- $customerPhone : string|null
- $customerPostcode : string|null
- $customerStreet : string|null
- $description : string|null
- $expirationDate : DateTime|null
- $files : Collection<int, TFileRel>
- $id : int|null
- $insertDatetime : DateTime
- $items : Collection<int, TItem>
- $order : TOrder|null
- $preferredSolution : TPreferredSolution|null
- $receiptDatetime : DateTime|null
- $solution : TSolution|null
- $status : TStatus|null
- $stockDocumentId : int|null
- $updateDatetime : DateTime|null
- $user : TUser|null
Methods
- __construct() : mixed
- addFile() : $this
- addItem() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getAdminNote() : string|null
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getCustomerCity() : string|null
- getCustomerEmail() : string|null
- getCustomerFirstname() : string|null
- getCustomerLastname() : string|null
- getCustomerPhone() : string|null
- getCustomerPostcode() : string|null
- getCustomerStreet() : string|null
- getDescription() : string|null
- getExpirationDate() : DateTime|null
- getFiles() : Collection<int, TFileRel>
- getId() : int|null
- getInsertDatetime() : DateTime
- getItems() : Collection<int, TItem>
- getOrder() : TOrder|null
- getOwnerUserId() : int|null
- getPreferredSolution() : TPreferredSolution|null
- getReceiptDatetime() : DateTime|null
- getSolution() : TSolution|null
- getStatus() : TStatus|null
- getStockDocumentId() : int|null
- getUpdateDatetime() : DateTime|null
- getUser() : TUser|null
- isPersisted() : bool
- removeFile() : $this
- removeItem() : $this
- setAdminNote() : $this
- setCustomerCity() : $this
- setCustomerEmail() : $this
- setCustomerFirstname() : $this
- setCustomerLastname() : $this
- setCustomerPhone() : $this
- setCustomerPostcode() : $this
- setCustomerStreet() : $this
- setDescription() : $this
- setExpirationDate() : $this
- setFiles() : $this
- setId() : $this
- setInsertDatetime() : $this
- setItems() : $this
- setOrder() : $this
- setPreferredSolution() : $this
- setReceiptDatetime() : $this
- setSolution() : $this
- setStatus() : $this
- setStockDocumentId() : $this
- setUpdateDatetime() : $this
- setUser() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$adminNote
protected
string|null
$adminNote
= null
Attributes
- #[Column]
- $name: 'admin_note'
- $type: 'text'
- $nullable: true
$customerCity
protected
string|null
$customerCity
= null
Attributes
- #[Column]
- $name: 'customer_city'
- $type: 'string'
- $length: 255
- $nullable: true
$customerEmail
protected
string|null
$customerEmail
= null
Attributes
- #[Column]
- $name: 'customer_email'
- $type: 'string'
- $length: 255
- $nullable: true
$customerFirstname
protected
string|null
$customerFirstname
= null
Attributes
- #[Column]
- $name: 'customer_firstname'
- $type: 'string'
- $length: 255
- $nullable: true
$customerLastname
protected
string|null
$customerLastname
= null
Attributes
- #[Column]
- $name: 'customer_lastname'
- $type: 'string'
- $length: 255
- $nullable: true
$customerPhone
protected
string|null
$customerPhone
= null
Attributes
- #[Column]
- $name: 'customer_phone'
- $type: 'string'
- $length: 255
- $nullable: true
$customerPostcode
protected
string|null
$customerPostcode
= null
Attributes
- #[Column]
- $name: 'customer_postcode'
- $type: 'string'
- $length: 20
- $nullable: true
$customerStreet
protected
string|null
$customerStreet
= null
Attributes
- #[Column]
- $name: 'customer_street'
- $type: 'string'
- $length: 255
- $nullable: true
$description
protected
string|null
$description
= null
Attributes
- #[Column]
- $name: 'description'
- $type: 'text'
- $nullable: true
$expirationDate
protected
DateTime|null
$expirationDate
= null
Attributes
- #[Column]
- $name: 'expiration_date'
- $type: 'date'
- $nullable: true
$files
protected
Collection<int, TFileRel>
$files
= new ArrayCollection()
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'complaint_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDatetime
protected
DateTime
$insertDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'insert_datetime'
- $type: 'datetime'
$items
protected
Collection<int, TItem>
$items
= new ArrayCollection()
$order
protected
TOrder|null
$order
= null
reference; the snapshot survives deleting the order (SET NULL)
$preferredSolution
protected
TPreferredSolution|null
$preferredSolution
= null
solution preferred by the customer
$receiptDatetime
protected
DateTime|null
$receiptDatetime
= null
Attributes
- #[Column]
- $name: 'receipt_datetime'
- $type: 'datetime'
- $nullable: true
$solution
protected
TSolution|null
$solution
= null
solution chosen by the admin
$status
protected
TStatus|null
$status
= null
$stockDocumentId
protected
int|null
$stockDocumentId
= null
Attributes
- #[Column]
- $name: 'stock_document_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- $nullable: true
$updateDatetime
protected
DateTime|null
$updateDatetime
= null
Attributes
- #[Column]
- $name: 'update_datetime'
- $type: 'datetime'
- $nullable: true
$user
protected
TUser|null
$user
= null
Methods
__construct()
public
__construct([int|null $id = null ][, mixed $order = null ][, mixed $user = null ][, mixed $status = null ][, mixed $solution = null ][, mixed $preferredSolution = null ][, string|null $description = null ][, string|null $adminNote = null ][, string|null $customerEmail = null ][, string|null $customerFirstname = null ][, string|null $customerLastname = null ][, string|null $customerPhone = null ][, string|null $customerStreet = null ][, string|null $customerCity = null ][, string|null $customerPostcode = null ][, DateTime|null $receiptDatetime = null ][, DateTime|null $expirationDate = null ][, int|null $stockDocumentId = null ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ][, Collection $items = new ArrayCollection() ][, Collection $files = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $order : mixed = null
- $user : mixed = null
- $status : mixed = null
- $solution : mixed = null
- $preferredSolution : mixed = null
- $description : string|null = null
- $adminNote : string|null = null
- $customerEmail : string|null = null
- $customerFirstname : string|null = null
- $customerLastname : string|null = null
- $customerPhone : string|null = null
- $customerStreet : string|null = null
- $customerCity : string|null = null
- $customerPostcode : string|null = null
- $receiptDatetime : DateTime|null = null
- $expirationDate : DateTime|null = null
- $stockDocumentId : int|null = null
- $insertDatetime : DateTime = new DateTime()
- $updateDatetime : DateTime|null = null
- $items : Collection = new ArrayCollection()
- $files : Collection = new ArrayCollection()
addFile()
public
addFile(TFileRel $file) : $this
Parameters
- $file : TFileRel
Return values
$thisaddItem()
public
addItem(TItem $item) : $this
Parameters
- $item : TItem
Return values
$thiscallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getAdminNote()
public
getAdminNote() : string|null
Return values
string|nullgetAllTraits()
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>getCustomerCity()
public
getCustomerCity() : string|null
Return values
string|nullgetCustomerEmail()
public
getCustomerEmail() : string|null
Return values
string|nullgetCustomerFirstname()
public
getCustomerFirstname() : string|null
Return values
string|nullgetCustomerLastname()
public
getCustomerLastname() : string|null
Return values
string|nullgetCustomerPhone()
public
getCustomerPhone() : string|null
Return values
string|nullgetCustomerPostcode()
public
getCustomerPostcode() : string|null
Return values
string|nullgetCustomerStreet()
public
getCustomerStreet() : string|null
Return values
string|nullgetDescription()
public
getDescription() : string|null
Return values
string|nullgetExpirationDate()
public
getExpirationDate() : DateTime|null
Return values
DateTime|nullgetFiles()
public
getFiles() : Collection<int, TFileRel>
Return values
Collection<int, TFileRel>getId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetItems()
public
getItems() : Collection<int, TItem>
Return values
Collection<int, TItem>getOrder()
public
getOrder() : TOrder|null
Return values
TOrder|nullgetOwnerUserId()
public
getOwnerUserId() : int|null
Return values
int|nullgetPreferredSolution()
public
getPreferredSolution() : TPreferredSolution|null
Return values
TPreferredSolution|nullgetReceiptDatetime()
public
getReceiptDatetime() : DateTime|null
Return values
DateTime|nullgetSolution()
public
getSolution() : TSolution|null
Return values
TSolution|nullgetStatus()
public
getStatus() : TStatus|null
Return values
TStatus|nullgetStockDocumentId()
public
getStockDocumentId() : int|null
Return values
int|nullgetUpdateDatetime()
public
getUpdateDatetime() : DateTime|null
Return values
DateTime|nullgetUser()
public
getUser() : TUser|null
Return values
TUser|nullisPersisted()
public
isPersisted() : bool
Return values
boolremoveFile()
public
removeFile(TFileRel $file) : $this
Parameters
- $file : TFileRel
Return values
$thisremoveItem()
public
removeItem(TItem $item) : $this
Parameters
- $item : TItem
Return values
$thissetAdminNote()
public
setAdminNote(string|null $adminNote) : $this
Parameters
- $adminNote : string|null
Return values
$thissetCustomerCity()
public
setCustomerCity(string|null $customerCity) : $this
Parameters
- $customerCity : string|null
Return values
$thissetCustomerEmail()
public
setCustomerEmail(string|null $customerEmail) : $this
Parameters
- $customerEmail : string|null
Return values
$thissetCustomerFirstname()
public
setCustomerFirstname(string|null $customerFirstname) : $this
Parameters
- $customerFirstname : string|null
Return values
$thissetCustomerLastname()
public
setCustomerLastname(string|null $customerLastname) : $this
Parameters
- $customerLastname : string|null
Return values
$thissetCustomerPhone()
public
setCustomerPhone(string|null $customerPhone) : $this
Parameters
- $customerPhone : string|null
Return values
$thissetCustomerPostcode()
public
setCustomerPostcode(string|null $customerPostcode) : $this
Parameters
- $customerPostcode : string|null
Return values
$thissetCustomerStreet()
public
setCustomerStreet(string|null $customerStreet) : $this
Parameters
- $customerStreet : string|null
Return values
$thissetDescription()
public
setDescription(string|null $description) : $this
Parameters
- $description : string|null
Return values
$thissetExpirationDate()
public
setExpirationDate(DateTime|null $expirationDate) : $this
Parameters
- $expirationDate : DateTime|null
Return values
$thissetFiles()
public
setFiles(Collection<int, TFileRel>|array<int, TFileRel> $files) : $this
Parameters
- $files : Collection<int, TFileRel>|array<int, TFileRel>
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetItems()
public
setItems(Collection<int, TItem>|array<int, TItem> $items) : $this
Parameters
- $items : Collection<int, TItem>|array<int, TItem>
Return values
$thissetOrder()
public
setOrder(TOrder|null $order) : $this
Parameters
- $order : TOrder|null
Return values
$thissetPreferredSolution()
public
setPreferredSolution(TPreferredSolution|null $preferredSolution) : $this
Parameters
- $preferredSolution : TPreferredSolution|null
Return values
$thissetReceiptDatetime()
public
setReceiptDatetime(DateTime|null $receiptDatetime) : $this
Parameters
- $receiptDatetime : DateTime|null
Return values
$thissetSolution()
public
setSolution(TSolution|null $solution) : $this
Parameters
- $solution : TSolution|null
Return values
$thissetStatus()
public
setStatus(TStatus|null $status) : $this
Parameters
- $status : TStatus|null
Return values
$thissetStockDocumentId()
public
setStockDocumentId(int|null $stockDocumentId) : $this
Parameters
- $stockDocumentId : int|null
Return values
$thissetUpdateDatetime()
public
setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
- $updateDatetime : DateTime|null
Return values
$thissetUser()
public
setUser(TUser|null $user) : $this
Parameters
- $user : TUser|null
Return values
$thisgetTraitsRecursive()
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>