Skip to content

Entities 0.4.3: Managed entities, image and video fields, and a per-field input

Entities 0.4.3 lets another PhoenixKit module own entities and protect them, adds image and video field types, and gives developers a control for editing a single field outside the admin form. The catalogue’s attribute sets are the first managed entities.

A managed entity is hidden from the general Entities admin. Ordinary code cannot rename it, change its status, touch its locked settings or take over its ownership; only the owning module can. Deleting one asks the owning module first and is refused if that check fails.

The new image and video fields store the id of a file from the media library. The admin record form shows the chosen file, or “No media selected — set through the owning app’s editor.” when there is none; the file is picked in the owning module’s own editor.

For developers, PhoenixKitEntities.Components.FieldInput renders the control of one field for table cells, chips or inline editors, and FormBuilder.cast_field/2 converts one value.

Two fixes: managed entities no longer reappear in the admin list after a reorder or a change elsewhere, and a bulk delete blocked by a strict foreign key now returns an error instead of crashing.

Full release notes: Entities 0.4.3

0.4.3 · 19 August 2026

Added

  • Managed blueprints (PhoenixKitEntities.Managed) — write-path protection for entities owned by another module (the catalogue’s attribute sets are the first consumer). Managed blueprints are hidden from the generic admin (include_managed: false) and protected against generic callers renaming identity/status, touching locked settings keys, or tampering with/acquiring the managed_by/locked_keys markers; owning modules bypass via on_behalf_of. Deletion consults an owner-registered guard held in :persistent_term and fails closed if the guard raises or exits.
  • PhoenixKitEntities.Components.FieldInput — a control-only per-field renderer for hosts that own their own layout (table cells, chips, inline editors), covering every field type with correct firing discipline (typed inputs debounce on blur, discrete inputs fire immediately). FormBuilder.cast_field/2 is the new public per-field cast for hosts with their own save events.
  • Real image/video field types — the stored value is a storage-file UUID selected through the host’s media picker, validated with Ecto.UUID.cast/1 at the cast, changeset, and render layers.

Fixed

  • Managed blueprints could reappear in the generic admin list after a drag-and-drop reorder or any entity-lifecycle PubSub broadcast (create/update/ delete anywhere in the app) — two of web/entities.ex’s five list_entities/1 call sites feeding the admin list were missing include_managed: false. Found and fixed in post-merge review of #31, pinned with regression tests.
  • EntityData.bulk_delete/2 crashed instead of returning :referenced_by_external when the referencing FK used an explicit ON DELETE RESTRICT (SQLSTATE 23001) rather than the default NO ACTION (23503) — bulk_delete/2‘s FK-violation classifier only recognized the latter. Pre-existing (issue #12), unrelated to #31; caught by the release gate’s mix test run.

Entities 0.4.3. Install or update: {:phoenix_kit_entities, "~> 0.4"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.