Skip to content

Commit

Permalink
Add comment truncation to ProvisioningHistoryRecord (NOJIRA)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Feb 7, 2024
1 parent 37ac9f6 commit d3e0de4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/src/Model/Table/ProvisioningHistoryRecordsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ public function initialize(array $config): void {
]);
}

/**
* Perform actions while marshaling data, before validation.
*
* @since COmanage Registry v5.0.0
* @param EventInterface $event Event
* @param ArrayObject $data Object data, in array format
* @param ArrayObject $options Entity save options
*/

public function beforeMarshal(EventInterface $event, \ArrayObject $data, \ArrayObject $options)
{
if(!empty($data['comment'])) {
// Truncate the comment to fit the column width
$column = $this->getSchema()->getColumn('comment');

$data['comment'] = substr($data['comment'], 0, $column['length']);
}
}

/**
* Table specific logic to generate a display field.
*
Expand Down

0 comments on commit d3e0de4

Please sign in to comment.