8000 Fix for ORM#is_dirty by tentwofour · Pull Request #268 · j4mie/idiorm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix for ORM#is_dirty #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion idiorm.php 8000
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ protected function _set_orm_property($key, $value = null, $expr = false) {
* object was saved.
*/
public function is_dirty($key) {
return isset($this->_dirty_fields[$key]);
return array_key_exists($key, $this->_dirty_fields);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion test/ORMTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ public function testIsNew() {
658E public function testIsDirty() {
$model = ORM::for_table('test')->create();
$this->assertFalse($model->is_dirty('test'));

$model = ORM::for_table('test')->create(array('test' => 'test'));
$this->assertTrue($model->is_dirty('test'));

$model->test = null;
$this->assertTrue($model->is_dirty('test'));

$model->test = '';
$this->assertTrue($model->is_dirty('test'));
}

public function testArrayAccess() {
Expand Down
0