| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace TestApp\Model\Table;
- use Tools\Model\Table\Table;
- use Cake\ORM\Entity;
- class ResetCommentsTable extends Table {
- public function initialize(array $config) {
- $this->displayField('comment');
- parent::initialize($config);
- }
- public function customCallback(Entity $record, &$updateFields) {
- $record->comment .= ' xyz';
- $fields[] = 'some_other_field';
- return $record;
- }
- public function customObjectCallback(Entity $record, &$updateFields) {
- $record['comment'] .= ' xxx';
- $updateFields[] = 'some_other_field';
- return $record;
- }
- public static function customStaticCallback(Entity $record, &$updateFields) {
- $record['comment'] .= ' yyy';
- $updateFields[] = 'some_other_field';
- return $record;
- }
- public static function fieldsCallback(Entity $record, &$updateFields) {
- $record['comment'] = 'foo';
- return $record;
- }
- public static function fieldsCallbackAuto(Entity $record, &$updateFields) {
- $record['comment'] = 'bar';
- $updateFields[] = 'comment';
- return $record;
- }
- }
|