Skip to content
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

Fixed website relation for nav container #412

Merged
merged 2 commits into from
Feb 26, 2024
Merged
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
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);
});
}
}
Loading