Skip to content

Commit

Permalink
Fixed website relation for nav container
Browse files Browse the repository at this point in the history
  • Loading branch information
hbugdoll committed Feb 26, 2024
1 parent 2138dec commit a6e76b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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 a6e76b5

Please sign in to comment.