- ⌂ cObject
- Methods
- Constructor
- add_variant()
- after_approve()
- approve()
- as_array()
- before_approve()
- can_add_variant()
- can_delete_variant()
- can_edit_variant()
- can_reorder_variant()
- clone()
- delete()
- edit_variant()
- enum()
- get_active_object()
- get_all_variants()
- get_attributes()
- get_dimensions()
- get_dimension_with()
- get_parent()
- get_primary_cpath()
- get_variant()
- Keywords()
- lock_object()
- meta()
- requires_approve()
- reload_data()
- repo()
- revert()
- save()
- store()
- unlock_object()
- update_from_array()
- validate()
cObject::after_approve()
Called after an object has been approved to the repository.
Prototype
void after_approve(mixed $data)
Parameters
- data - Return value from before_approve().
Example
<?php
namespace com_example_www\models;
class Contact extends \io_comand_repo\models\Content {
public function before_approve(array $options): mixed {
// approve embedded notes, even if they haven't updated
$notes_to_approve = [];
foreach($this->Notes as $note) {
if($note->Update) {
$notes_to_approve []= $note;
}
}
return [
'options' => $options,
'notes_to_approve' => $notes_to_approve,
];
}
public function after_approve(mixed $data): void {
// approve embedded notes, even if they haven't updated
foreach($data['notes_to_approve'] as $note) {
$note->approve();
}
}
}