Skip to content

Commit

Permalink
Additional commit for CFM-24
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Oct 28, 2025
1 parent 8e0b5ab commit 9830997
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,19 @@ public function edit(string $id) {
$this->set('vv_subtitle', $subtitle);
}

// Inject the changelog archive information so the view can render it, similar to view
$clAttr = $obj->changelogAttributeName();

// As a first pass, we only pull the object itself (no related models)

$archives = $table->find()
->applyOptions(['archived' => true])
->where([$clAttr => $id])
->order(['revision' => 'DESC'])
->all();

$this->set('vv_archives', $archives);

// Let the view render
$this->render('/Standard/add-edit-view');
}
Expand Down Expand Up @@ -781,8 +794,10 @@ public function view($id = null) {
$table = $this->getCurrentTable();

// We use findById() rather than get() so we can apply subsequent
// query modifications via traits
$query = $table->findById($id);
// query modifications via traits. We allow ChangelogBehavior to return
// archived copies when directly queried.
$query = $table->findById($id)
->applyOptions(['archived' => true]);

// QueryModificationTrait
if(method_exists($table, "getViewContains")) {
Expand Down Expand Up @@ -816,6 +831,18 @@ public function view($id = null) {
$this->set('vv_supertitle', $supertitle);
$this->set('vv_subtitle', $subtitle);

// Inject the changelog archive information so the view can render it, similar to edit
$clAttr = $obj->changelogAttributeName();

// As a first pass, we only pull the object itself (no related models)
$archives = $table->find()
->applyOptions(['archived' => true])
->where([$clAttr => $id])
->order(['revision' => 'DESC'])
->all();

$this->set('vv_archives', $archives);

// Let the view render
$this->render('/Standard/add-edit-view');
}
Expand Down

0 comments on commit 9830997

Please sign in to comment.