Last active
August 29, 2015 14:14
-
-
Save svandragt/42863fdc18e7062955c0 to your computer and use it in GitHub Desktop.
BUG isChanged is not comparing to the databasefields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
*/ | |
class TempTask extends BuildTask { | |
protected $title = 'TempTask'; | |
protected $description = ''; | |
public function run($request) { | |
# correct behaviour: title hasn't changed as it is set to the original value | |
$MyDataObject = Page::get_by_link('/'); | |
$title = $MyDataObject->Title; | |
$MyDataObject->Title = $title; | |
Debug::show($MyDataObject->getChangedFields(false, 2)); | |
# BUG isChanged is not comparing to the databasefields but to the last value of the property | |
# expected behaviour: not changed. actual behaviour: changed | |
$title = $MyDataObject->Title; | |
$MyDataObject->Title = null; | |
$MyDataObject->Title = $title; | |
Debug::show($MyDataObject->getChangedFields(false, 2)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment