Skip to content

Commit

Permalink
Merge pull request #412 from hbugdoll/master
Browse files Browse the repository at this point in the history
Fixed website relation for nav container
  • Loading branch information
nadar authored Feb 26, 2024
2 parents 2138dec + 3afee3f commit 496cebc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE

## 5.1.1

+ [#412](https://github.com/luyadev/luya-module-cms/pull/412) Fixed website relation for nav container (when accessing `navContainer->website`).
+ [#410](https://github.com/luyadev/luya-module-cms/pull/410) Disabled sorting functionality for the "group" extra field in the block CRUD interface due to an exception being thrown. This issue occurred because the field is declared as an `extraAttribute`.
+ [#409](https://github.com/luyadev/luya-module-cms/issues/409) Implemented a new validation check to prevent slug duplication within the same language and navigation hierarchy when creating a new page. This enhancement ensures unique page identification and avoids conflicts in site structure.

Expand Down
5 changes: 3 additions & 2 deletions src/models/NavContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/**
* Navigation-Containers Model.
*
* @property integer $id
* @property string $name
* @property string $alias
* @property integer $website_id
Expand Down Expand Up @@ -58,7 +59,7 @@ public function rules()
{
return [
[['name', 'alias', 'website_id'], 'required'],
[['website_id', 'is_deleted', 'website_id'], 'integer'],
[['website_id'], 'integer'],
[['is_deleted'], 'boolean']
];
}
Expand Down Expand Up @@ -113,6 +114,6 @@ public function getNavs()
*/
public function getWebsite()
{
return $this->hasOne(Website::class, ['website_id' => 'id']);
return $this->hasOne(Website::class, ['id' => 'website_id']);
}
}
5 changes: 5 additions & 0 deletions tests/src/models/NavContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public function testFindWebsiteContainer()

$this->assertEquals(2, $navContainer->website_id);
$this->assertSame('test container', $navContainer->name);

$website = $navContainer->website;

$this->assertEquals(2, $website->id);
$this->assertSame('test', $website->name);
});
}
}

0 comments on commit 496cebc

Please sign in to comment.