|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* _ __ __ _____ _____ ___ ____ _____ |
|
5
|
|
|
* | | / // // ___//_ _// || __||_ _| |
|
6
|
|
|
* | |/ // /(__ ) / / / /| || | | | |
|
7
|
|
|
* |___//_//____/ /_/ /_/ |_||_| |_| |
|
8
|
|
|
* @link https://vistart.me/ |
|
9
|
|
|
* @copyright Copyright (c) 2016 - 2017 vistart |
|
10
|
|
|
* @license https://vistart.me/license/ |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace rhosocial\user\models\invitation\registration; |
|
14
|
|
|
|
|
15
|
|
|
use rhosocial\user\models\invitation\Invitation; |
|
16
|
|
|
use rhosocial\user\User; |
|
17
|
|
|
use yii\base\InvalidConfigException; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Class Registration |
|
21
|
|
|
* @package rhosocial\user\models\invitation\registration |
|
22
|
|
|
* @version 1.0 |
|
23
|
|
|
* @author vistart <[email protected]> |
|
24
|
|
|
*/ |
|
25
|
|
|
class Registration extends Invitation |
|
26
|
|
|
{ |
|
27
|
|
|
const INVITATION_REGISTRATION = 0x01; |
|
28
|
|
|
public $allowRepeated = false; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @inheritdoc |
|
32
|
|
|
*/ |
|
33
|
6 |
|
public function init() |
|
34
|
|
|
{ |
|
35
|
6 |
|
parent::init(); |
|
36
|
6 |
|
if ($this->getIsNewRecord()) { |
|
37
|
6 |
|
$this->content = self::INVITATION_REGISTRATION; |
|
38
|
|
|
} elseif ($this->content != self::INVITATION_REGISTRATION) { |
|
39
|
|
|
throw new InvalidConfigException("This invitation is not being used for registration."); |
|
40
|
|
|
} |
|
41
|
6 |
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Returns the search instance and limits the search range to the registration. |
|
45
|
|
|
* @return BaseBlameableQuery |
|
46
|
|
|
*/ |
|
47
|
6 |
|
public static function find() |
|
48
|
|
|
{ |
|
49
|
6 |
|
return parent::find()->content(self::INVITATION_REGISTRATION); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Returns the search instance and attach the specific invitee. |
|
54
|
|
|
* @param User|string|array $invitee |
|
55
|
|
|
* @return BaseBlameableQuery |
|
56
|
|
|
*/ |
|
57
|
1 |
|
public static function findByInvitee($invitee) |
|
58
|
|
|
{ |
|
59
|
1 |
|
return parent::findByInvitee($invitee)->content(self::INVITATION_REGISTRATION); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|