1 | <?php |
||
19 | abstract class Owner extends \yii\db\ActiveRecord |
||
20 | { |
||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | public function rules() |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function attributeLabels() |
||
61 | |||
62 | /** |
||
63 | * Get model (mediafile/album) primary key name. |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | abstract protected static function getModelKeyName(): string; |
||
68 | |||
69 | /** |
||
70 | * Add owner to mediafiles table. |
||
71 | * |
||
72 | * @param int $modelId |
||
73 | * @param int $ownerId |
||
74 | * @param string $owner |
||
75 | * @param string $ownerAttribute |
||
76 | * |
||
77 | * @return bool |
||
78 | */ |
||
79 | public static function addOwner(int $modelId, int $ownerId, string $owner, string $ownerAttribute): bool |
||
89 | |||
90 | /** |
||
91 | * Remove this mediafile/album owner. |
||
92 | * |
||
93 | * @param int $ownerId |
||
94 | * @param string $owner |
||
95 | * @param string $ownerAttribute |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | public static function removeOwner(int $ownerId, string $owner, string $ownerAttribute): bool |
||
109 | |||
110 | /** |
||
111 | * Get Id's by owner. |
||
112 | * |
||
113 | * @param string $nameId |
||
114 | * @param array $args It can be an array of the next params: owner{string}, ownerId{int}, ownerAttribute{string}. |
||
115 | * |
||
116 | * @throws InvalidArgumentException |
||
117 | * |
||
118 | * @return ActiveQuery |
||
119 | */ |
||
120 | protected static function getEntityIdsQuery(string $nameId, array $args): ActiveQuery |
||
154 | } |
||
155 |