1 | <?php |
||
36 | abstract class Document extends EmbeddedDocument implements ActiveRecordInterface |
||
37 | { |
||
38 | |||
39 | use EntityManagerTrait, |
||
40 | FinderTrait, |
||
41 | CollectionNameTrait, |
||
42 | WithCriteriaTrait; |
||
43 | |||
44 | /** |
||
45 | * Mongo id field |
||
46 | * @Label('Database ID') |
||
47 | * @Sanitizer(MongoObjectId) |
||
48 | * @see MongoObjectId |
||
49 | * @var MongoId|null |
||
50 | */ |
||
51 | public $_id = null; |
||
52 | |||
53 | /** |
||
54 | * Alias to _id |
||
55 | * @Label('Database ID') |
||
56 | * @Persistent(false) |
||
57 | * @Alias('_id') |
||
58 | * @see https://github.com/Maslosoft/Mangan/issues/40 |
||
59 | * @var string|null |
||
60 | */ |
||
61 | public $id = null; |
||
62 | |||
63 | /** |
||
64 | * Constructor |
||
65 | * @see ScenarioManager |
||
66 | * |
||
67 | * @param string $scenario |
||
68 | * @param string $lang Language code |
||
69 | * @since v1.0 |
||
70 | */ |
||
71 | 56 | public function __construct($scenario = 'insert', $lang = '') |
|
79 | |||
80 | /** |
||
81 | * Returns the empty model of the specified Document class. |
||
82 | * It is provided for invoking class-level methods, espacially userfull for finders. |
||
83 | * |
||
84 | * Example usage: |
||
85 | * ```php |
||
86 | * $user = User::model()->findByPk('5612470866a19540308b4568'); |
||
87 | * ``` |
||
88 | * @param string $lang |
||
89 | * @return Document model instance. |
||
90 | */ |
||
91 | public static function model($lang = null) |
||
95 | |||
96 | } |
||
97 |