-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,15 @@ | |
use yii\base\InvalidConfigException; | ||
|
||
/** | ||
* SubsidiaryTrait. | ||
* The Trait is used to help the model manage its subsidiary models. | ||
* | ||
* For example: | ||
* ```php | ||
* $user->addSubsidiaryClass("email", ["class" => Email::class]); | ||
* $email = $user->createEmail(['content' => '[email protected]']); | ||
* $email->save(); | ||
* ``` | ||
* @version 1.0 | ||
* @author vistart <[email protected]> | ||
*/ | ||
|
@@ -72,7 +81,7 @@ public function addSubsidiaryClass($name, $config) | |
|
||
/** | ||
* Remove subsidiary. | ||
* @param string $name | ||
* @param string $name Subsidiary name, case insensitive. | ||
* @return boolean | ||
*/ | ||
public function removeSubsidiary($name) | ||
|
@@ -86,8 +95,8 @@ public function removeSubsidiary($name) | |
} | ||
|
||
/** | ||
* Get subsidiary class. | ||
* @param string $name | ||
* Get subsidiary class according name. | ||
* @param string $name Subsidiary name, case insensitive. | ||
* @return string | ||
*/ | ||
public function getSubsidiaryClass($name) | ||
|
@@ -101,7 +110,7 @@ public function getSubsidiaryClass($name) | |
|
||
/** | ||
* Get subsidiaries. | ||
* @param $name | ||
* @param $name Subsidiary name, case insensitive. | ||
* @param string $limit | ||
* @param int $page | ||
* @return null | ||
|
@@ -199,9 +208,9 @@ public function create($className, $config = [], $loadDefault = true, $skipIfSet | |
} | ||
|
||
/** | ||
* | ||
* @param string $name | ||
* @param array $config | ||
* Create subsidiary model. | ||
* @param string $name Subsidiary name, case insensitive. | ||
* @param array $config Subsidiary model configuration array. | ||
* @return mixed | ||
*/ | ||
public function createSubsidiary($name, $config) | ||
|