Hi,
Good news — you don't need a post-export script or a custom extension for this. Skipper already supports @Gedmo\Versioned fully (it round-trips on both import and export). It's simply modeled in a different place than you'd expect, which is why your custom attribute was saved into the .skipper file but dropped on export.
The key concept
@Gedmo\Versioned is not configured as an attribute on the field. It's configured on the entity's Loggable extension, as a list of the fields (and relations) that should be tracked. During export, Skipper takes that list and writes @Gedmo\Versioned onto each of those fields automatically.
This is the same pattern used by Timestampable, Blameable and IpTraceable — an entity-level list that produces per-field annotations.
How to set it up (no scripting)
- Select the entity and open its Gedmo extension settings — the same place where you added Loggable.
- Under Loggable → Fields, add one entry per field you want versioned. Each entry is a reference to an existing field on the entity (you pick the field, it's not free text).
- For a versioned relation (e.g. a ManyToOne / owning-side association), add it to the association list in the same Loggable section.
- Export as usual.
Result
The entity gets @Gedmo\Loggable, and every field/relation you listed gets @Gedmo\Versioned:
/**
* @Gedmo\Loggable
*/
class Article
{
/**
* @Gedmo\Versioned
* @ORM\Column(type="string")
*/
private $title;
}
This works for all Doctrine output formats — PHP annotations, PHP 8 attributes, XML and YAML — and it's read back correctly on re-import, so your round-trip stays intact.
Two things to note
- Please revert the custom Gedmo-extension change you made. The built-in export only emits
Versioned from the Loggable fields list, so a separate custom field attribute will always be lost — that part is expected behavior, not a bug.
- A field has to exist on the entity to be referenced in the Loggable list (it's a field reference). If you were trying to mark something that isn't part of the Skipper model, add it as a field first, then reference it.
Hope this helps — let us know if anything is unclear and we'll be glad to walk through it.