Skip to content

v0.4.0 — generic contact link

Choose a tag to compare

@johbrock johbrock released this 20 Aug 20:28
· 17 commits to main since this release

Breaking

Communicator::send() no longer takes a customer: argument, and communications.customer_id is gone. The module now depends on no domain implementation — it never names a customer, party or member.

The two record links

A communication references two records polymorphically, independently of each other:

Columns Relation Meaning
model_type / model_id model() the source record the mail was generated from
contact_type / contact_id contact() the record the mail concerns
app(Communicator::class)->send(
    mailable: new OrderConfirmationMail($order),
    to: $order->email,
    contact: $order->party,   // was: customer: $order->customer
    model: $order,
);

contact: accepts any Eloquent model (the previous int form is gone — a bare id carries no type). It defaults to to: when that is itself a model, and the tenant is still derived from the contact's tenant_id when no tenantSettings are supplied.

Upgrading

Consumers that passed customer: rename it to contact:. Nothing else changes.

Existing installations get contact_type/contact_id from a purely additive migration — no data is moved or dropped by this module. Migrating legacy customer_id values is left to the modules that wrote them, because only they know which record an id refers to. noerd/liefertool and noerd/booking-members ship those migrations; the drop of the legacy column stands down while any unmigrated row remains.

Also in this release

  • The migration set is consolidated from 10 files to 5: a fresh install now gets the final schema directly, with no conversion step.
  • noerd/customer is no longer a dependency.