Gitify icon indicating copy to clipboard operation
Gitify copied to clipboard

Support relations (aggregate/composite) in a way that makes sense to humans

Open Mark-H opened this issue 11 years ago • 3 comments

It would be nice to - in a similar way the content works - make use of subdirectories to store relations.

A model mpPackage with one-to-many mpVersion objects could be represented in the .gitify like this:

data:
  packages:
    class: mpPackage
    primary: name
    relations: 
       versions:
         class: mpVersion
         alias: Version 
         primary: signature

which would then result in a directory structure like this for a one-to-many relation:

_data/
  packages/
    redactor.yaml
    redactor/
      versions/
        1.5.0-pl.yaml

A one-to-one relation, for example modUser/modUserProfile, could be in the .gitify file like this:

data:
  packages:
    class: modUser
    primary: username
    relations: 
       profile:
         class: modUserProfile
         alias: Profile

As it's one-to-one, there would (ideally) be no need to specify a primary. Gitify could fetch that from the model and base it off the modUser record.

The profile file would be stored with the name from the reference ("profile") in a directory with the primary from the modUser, like so:

_data/
  users/
    marksusername.yaml
    marksusername/
      profile.yaml

Of course combinations and multiple relations need to be supported.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Mark-H avatar Sep 11 '14 14:09 Mark-H

Would also be good to do this for template variable values. Either store TV values as subdirectory data (less optimal) or within the resource's html file (more optimal, from an editing perspective).

isaacniebeling avatar Dec 12 '14 17:12 isaacniebeling

Maybe with one-to-(one/many) relations we could skip adding extra directories and files, instead adding it right in to the main object.. like the example with the package/versions, that could in redactor.yaml contain a versions array with all the versions..

Mark-H avatar Dec 22 '14 15:12 Mark-H

And with plugin events (#14) that would be like..

data:
  packages:
    class: modPlugin
    primary: name
    relations: 
       events:
         class: modPluginEvent
         alias: Events
name: MyPlugin
description: best one ever
events:
  -
    event: OnHandleRequest
    priority: 5
    propertyset: 0
  -
    event: OnDocFormRender
    priority: 2
    propertyset: 0

-----

$hello = 'Hi!';
$world = 'Earth';

$event->output($hello . $world);

Mark-H avatar Dec 22 '14 15:12 Mark-H