wmk

Do you mean "Version" in meaning of "history", or do you mean Product Version in the meaning of "ProductVariation" ? E.g. a t-shirt can have different sizes, but is the same t-shirt for the shop

suriq

so, if i want to do recursion i need something like that?

  1. class Product extends DataObject {
wmk

Well, Versions extension is mostly to have, well, versioning and stage/live of a given record. You can have "simple" versioning for history of a record.

suriq

I try to understand version mechanism but my php kungfu is not strong enough 😕

wmk

But as @andante wrote: maybe built in version system is enough for your needs? See https://docs.silverstripe.org/en/4/developer_guides/model/versioning/#versioning

Show 1 attachment(s)
docs.silverstripe.org  
Versioning

Developer and user documentation for the Silverstripe CMS and framework.

Hide attachment content
wmk

ah. So Product also needs a has_one to Product called "ProductVersionList" or so... See also https://docs.silverstripe.org/en/4/developer_guides/model/relations/#has-many for "multiple relations to same record" stuff.

Show 1 attachment(s)
docs.silverstripe.org  
Relations between Records

Developer and user documentation for the Silverstripe CMS and framework.

Hide attachment content
andante

Version is a defined thing, you might want to go with "Types" or "Iterations" or "Variations" or something

suriq

I used https://docs.silverstripe.org/en/4/developer_guides/model/relations/ way but i cannot do it right i suppose

Show 1 attachment(s)
docs.silverstripe.org  
Relations between Records

Developer and user documentation for the Silverstripe CMS and framework.

Hide attachment content
suriq

if i do class Product extends DataObject .... private static $has_many =['Versions' => Product::class] i get error 😞