Commit 81cbb5b 1 parent f76957a commit 81cbb5b Copy full SHA for 81cbb5b
File tree 6 files changed +19
-8
lines changed
6 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 8
8
9
9
namespace Vazaha \Mastodon \Models \Admin ;
10
10
11
- use Vazaha \Mastodon \Models \Model ;
11
+ use Vazaha \Mastodon \Models \TagModel as ModelsTagModel ;
12
12
13
13
/**
14
14
* Represents a hashtag used within the content of a status.
15
15
*/
16
- class TagModel extends Model
16
+ class TagModel extends ModelsTagModel
17
17
{
18
18
/**
19
19
* The ID of the Tag in the database.
Original file line number Diff line number Diff line change 11
11
/**
12
12
* Represents a user of Mastodon and their associated profile.
13
13
*/
14
- class CredentialAccountModel extends Model
14
+ class CredentialAccountModel extends AccountModel
15
15
{
16
16
/**
17
17
* An extra attribute that contains source values to be used with API methods
Original file line number Diff line number Diff line change 13
13
/**
14
14
* Represents a user of Mastodon and their associated profile.
15
15
*/
16
- class MutedAccountModel extends Model
16
+ class MutedAccountModel extends AccountModel
17
17
{
18
18
/**
19
19
* When a timed mute will expire, if applicable.
Original file line number Diff line number Diff line change 8
8
9
9
namespace Vazaha \Mastodon \Models \Trends ;
10
10
11
- use Vazaha \Mastodon \Models \Model ;
11
+ use Vazaha \Mastodon \Models \PreviewCardModel ;
12
12
13
13
/**
14
14
* Represents a rich preview card that is generated using OpenGraph tags from a URL.
15
15
*/
16
- class LinkModel extends Model
16
+ class LinkModel extends PreviewCardModel
17
17
{
18
18
/**
19
19
* Usage statistics for given days (typically the past week).
Original file line number Diff line number Diff line change @@ -16,15 +16,26 @@ class ModelClassTemplate extends ClassTemplate
16
16
17
17
protected function getTemplateVars (): array
18
18
{
19
- $ specs = $ this ->loadEntitySpecs ();
19
+ $ this ->loadEntitySpecs ();
20
20
$ this ->imports ->add (new ClassName (Model::class));
21
21
22
+ $ specs = $ this ->entitySpecs [$ this ->entity ->name ];
23
+
24
+ if (!empty ($ specs ['parent ' ]) && $ specs ['parent ' ] !== $ this ->entity ->name ) {
25
+ $ parentClass = ClassName::fromEntity (
26
+ new Entity ($ this ->entitySpecs [$ this ->entity ->name ]['parent ' ]),
27
+ ClassType::MODEL ,
28
+ );
29
+ $ this ->imports ->add ($ parentClass );
30
+ }
31
+
22
32
return [
23
33
'namespace ' => $ this ->entity ->getNamespace ($ this ->getClassType ()),
24
34
'classname ' => $ this ->entity ->getBaseClassName ($ this ->getClassType ()),
25
35
'classImports ' => $ this ->imports ,
26
36
'properties ' => $ this ->getProperties (),
27
37
'description ' => $ this ->entitySpecs [$ this ->entity ->name ]['description ' ] ?? '' ,
38
+ 'parentClass ' => $ parentClass ?? null ,
28
39
];
29
40
}
30
41
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ namespace {{ namespace }};
15
15
/**
16
16
* {{ description }}
17
17
*/
18
- class {{ classname }} extends Model
18
+ class {{ classname }} extends { % if parentClass % }{{ parentClass }}{ % else % } Model { % endif % }
19
19
{
20
20
{% for property in properties % }
21
21
{% if property . descriptionLines % }
You can’t perform that action at this time.
0 commit comments