Skip to content

Commit

Permalink
remove references to addDynamicProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Jan 30, 2024
1 parent d3f020b commit 8faea4a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
11 changes: 0 additions & 11 deletions src/Halcyon/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1603,17 +1603,6 @@ public static function cacheMutatedAttributes($class)
static::$mutatorCache[$class] = $mutatedAttributes;
}

public function addDynamicProperty($dynamicName, $value = null)
{
if (isset($this->attributes[$dynamicName])) {
return;
}
$this->setAttribute($dynamicName, $value);

// only need to be set to exclude those attributes from getSettingsAttribute()
array_set($this->extensionData['dynamicProperties'], $dynamicName, null);
}

/**
* Dynamically retrieve attributes on the model.
*
Expand Down
22 changes: 0 additions & 22 deletions tests/Halcyon/HalcyonModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public function testFindAll()
{
$pages = HalcyonTestPage::all();

$this->assertCount(2, $pages);
$this->assertContains('about.htm', $pages->lists('fileName'));
$this->assertContains('home.htm', $pages->lists('fileName'));
}
Expand Down Expand Up @@ -349,27 +348,6 @@ public function testPageQueryListFileName()
$this->assertEquals(['about.htm', 'home.htm'], $files);
}

public function testAddDynamicPoperty()
{
@unlink($targetFile = __DIR__.'/../fixtures/halcyon/themes/theme1/pages/dynamicproperty.htm');

$page = HalcyonTestPage::create([
'fileName' => 'dynamicproperty',
'title' => 'Add Dynamic Property',
'markup' => '<p>Foo bar!</p>'
]);

$page->addDynamicProperty('myDynamicProperty', 'myDynamicPropertyValue');
$this->assertArrayHasKey('myDynamicProperty', $page->attributes);
$this->assertEquals('myDynamicPropertyValue', $page->myDynamicProperty);
$page->save();
$page = HalcyonTestPage::find('dynamicproperty');
$this->assertNotNull($page);
// Dynamic properties should not be saved to DB layer
$this->assertArrayNotHasKey('myDynamicProperty', $page->attributes);
@unlink($targetFile);
}

//
// House keeping
//
Expand Down

0 comments on commit 8faea4a

Please sign in to comment.