Skip to content

How should afterUpdate method be triggered when saving object does not result in MySQL query? #1

@gajus

Description

@gajus

Suppose that you construct an object, e.g.

<?php
$string = new \Sandbox\Model\String($this->db);
$string['name'] = 'foo';
$string->save(); // INSERTs object to the database and triggers "afterInsert" method
$string['name'] = 'bar';
$string->save(); // UPDATEs object's instance in the database and triggers "afterUpdate" method
$string->save(); // Does not not execute MySQL query because object state has not changed.

Should the 3rd call to save:

  1. Issue MySQL query? (even though it is assumed that it will not affect the record)
  2. If query is not executed, should the afterUpdate method be triggered?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions