| @@ 23-56 (lines=34) @@ | ||
| 20 | * |
|
| 21 | * @property static $this |
|
| 22 | */ |
|
| 23 | trait AttachmentRelations |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * An attachment is belong to one issue (inverse relationship of Project\Issue::attachments). |
|
| 27 | * |
|
| 28 | * @return Relations\BelongsTo |
|
| 29 | */ |
|
| 30 | public function issue() |
|
| 31 | { |
|
| 32 | return $this->belongsTo('Tinyissue\Model\Project\Issue', 'issue_id'); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * An attachment has one user upladed to (inverse relationship of User::attachments). |
|
| 37 | * |
|
| 38 | * @return Relations\BelongsTo |
|
| 39 | */ |
|
| 40 | public function user() |
|
| 41 | { |
|
| 42 | return $this->belongsTo('Tinyissue\Model\User', 'uploaded_by'); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * An attachment can belong to a comment (inverse relationship of Comments::attachments). |
|
| 47 | * |
|
| 48 | * @return Relations\BelongsTo |
|
| 49 | */ |
|
| 50 | public function comment() |
|
| 51 | { |
|
| 52 | return $this->belongsTo('Tinyissue\Model\Project\Issue\Comment', 'comment_id'); |
|
| 53 | } |
|
| 54 | ||
| 55 | abstract public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null); |
|
| 56 | } |
|
| 57 | ||
| @@ 23-56 (lines=34) @@ | ||
| 20 | * |
|
| 21 | * @property static $this |
|
| 22 | */ |
|
| 23 | trait RelationTrait |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * An attachment is belong to one issue (inverse relationship of Project\Issue::attachments). |
|
| 27 | * |
|
| 28 | * @return Relations\BelongsTo |
|
| 29 | */ |
|
| 30 | public function issue() |
|
| 31 | { |
|
| 32 | return $this->belongsTo('Tinyissue\Model\Project\Issue', 'issue_id'); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * An attachment has one user upladed to (inverse relationship of User::attachments). |
|
| 37 | * |
|
| 38 | * @return Relations\BelongsTo |
|
| 39 | */ |
|
| 40 | public function user() |
|
| 41 | { |
|
| 42 | return $this->belongsTo('Tinyissue\Model\User', 'uploaded_by'); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * An attachment can belong to a comment (inverse relationship of Comments::attachments). |
|
| 47 | * |
|
| 48 | * @return Relations\BelongsTo |
|
| 49 | */ |
|
| 50 | public function comment() |
|
| 51 | { |
|
| 52 | return $this->belongsTo('Tinyissue\Model\Project\Issue\Comment', 'comment_id'); |
|
| 53 | } |
|
| 54 | ||
| 55 | abstract public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null); |
|
| 56 | } |
|
| 57 | ||
| @@ 23-56 (lines=34) @@ | ||
| 20 | * |
|
| 21 | * @property static $this |
|
| 22 | */ |
|
| 23 | trait RelationTrait |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * An attachment is belong to one issue (inverse relationship of Project\Issue::attachments). |
|
| 27 | * |
|
| 28 | * @return Relations\BelongsTo |
|
| 29 | */ |
|
| 30 | public function issue() |
|
| 31 | { |
|
| 32 | return $this->belongsTo('Tinyissue\Model\Project\Issue', 'issue_id'); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * An attachment has one user upladed to (inverse relationship of User::attachments). |
|
| 37 | * |
|
| 38 | * @return Relations\BelongsTo |
|
| 39 | */ |
|
| 40 | public function user() |
|
| 41 | { |
|
| 42 | return $this->belongsTo('Tinyissue\Model\User', 'uploaded_by'); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * An attachment can belong to a comment (inverse relationship of Comments::attachments). |
|
| 47 | * |
|
| 48 | * @return Relations\BelongsTo |
|
| 49 | */ |
|
| 50 | public function comment() |
|
| 51 | { |
|
| 52 | return $this->belongsTo('Tinyissue\Model\Project\Issue\Comment', 'comment_id'); |
|
| 53 | } |
|
| 54 | ||
| 55 | abstract public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null); |
|
| 56 | } |
|
| 57 | ||