Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit115dd3b

Browse files
committed
[EAV] Value::setAttribute add return this
1 parent3bf84ae commit115dd3b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

‎More/EAV/Tests/ValueTest.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function testSetGetAttribute()
4040
$value->setName('Silver');
4141
$this->assertSame($attribute,$value->getAttribute());
4242

43-
$value->setAttribute($attribute);
44-
$this->assertSame($attribute,$value->getAttribute());
43+
$this->assertSame($attribute,$value->setAttribute($attribute)->getAttribute());
4544
}
4645
}

‎More/EAV/Value.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ public function __construct(Attribute $attribute)
2828

2929
/**
3030
* @param Attribute $attribute
31+
* @return $this
3132
*/
3233
publicfunctionsetAttribute(Attribute$attribute)
3334
{
3435
$this->attribute->removeValue($this);// Remove value from current attribute
3536
$attribute->addValue($this);// Add value to new attribute
3637
$this->attribute =$attribute;
38+
39+
return$this;
3740
}
3841

3942
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp