Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
votingapi
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
votingapi
Merge requests
!48
An error occurred while fetching the assigned milestone of the selected merge_request.
Issue
#3509000
by tr: Strict typing and fluent interface for Vote entity
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3509000
by tr: Strict typing and fluent interface for Vote entity
issue/votingapi-3509000:3509000-strict-typing-and
into
4.0.x
Overview
0
Commits
26
Pipelines
12
Changes
16
Merged
Tim Rohaly
requested to merge
issue/votingapi-3509000:3509000-strict-typing-and
into
4.0.x
3 months ago
Overview
0
Commits
26
Pipelines
12
Changes
16
Expand
Closes
#3509000
0
0
Merge request reports
Compare
4.0.x
version 11
727b3954
3 months ago
version 10
a83aa031
3 months ago
version 9
eb77daa7
3 months ago
version 8
f78f6f99
3 months ago
version 7
8454f71f
3 months ago
version 6
c6c2f214
3 months ago
version 5
d4b6cc67
3 months ago
version 4
963e9d54
3 months ago
version 3
11d29d9a
3 months ago
version 2
10d554e7
3 months ago
version 1
0893124e
3 months ago
4.0.x (base)
and
latest version
latest version
727b3954
26 commits,
3 months ago
version 11
727b3954
26 commits,
3 months ago
version 10
a83aa031
25 commits,
3 months ago
version 9
eb77daa7
15 commits,
3 months ago
version 8
f78f6f99
7 commits,
3 months ago
version 7
8454f71f
7 commits,
3 months ago
version 6
c6c2f214
6 commits,
3 months ago
version 5
d4b6cc67
5 commits,
3 months ago
version 4
963e9d54
4 commits,
3 months ago
version 3
11d29d9a
3 commits,
3 months ago
version 2
10d554e7
2 commits,
3 months ago
version 1
0893124e
1 commit,
3 months ago
16 files
+
103
−
89
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
16
Search (e.g. *.vue) (Ctrl+P)
src/Entity/Vote.php
+
23
−
23
Options
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\votingapi\Entity
;
use
Drupal\Core\Entity\ContentEntityBase
;
@@ -52,122 +54,120 @@ class Vote extends ContentEntityBase implements VoteInterface {
/**
* {@inheritdoc}
*/
public
function
getVotedEntityType
()
{
public
function
getVotedEntityType
()
:
string
{
return
$this
->
get
(
'entity_type'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setVotedEntityType
(
$name
)
{
public
function
setVotedEntityType
(
string
$name
):
static
{
return
$this
->
set
(
'entity_type'
,
$name
);
}
/**
* {@inheritdoc}
*/
public
function
getVotedEntityId
()
{
public
function
getVotedEntityId
()
:
string
|
int
{
return
$this
->
get
(
'entity_id'
)
->
target_id
;
}
/**
* {@inheritdoc}
*/
public
function
setVotedEntityId
(
$id
)
{
public
function
setVotedEntityId
(
string
|
int
$id
):
static
{
return
$this
->
set
(
'entity_id'
,
$id
);
}
/**
* {@inheritdoc}
*/
public
function
getValue
()
{
return
$this
->
get
(
'value'
)
->
value
;
public
function
getValue
()
:
float
{
return
(
float
)
$this
->
get
(
'value'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setValue
(
$value
)
{
public
function
setValue
(
float
$value
)
:
static
{
return
$this
->
set
(
'value'
,
$value
);
}
/**
* {@inheritdoc}
*/
public
function
getValueType
()
{
public
function
getValueType
()
:
string
{
return
$this
->
get
(
'value_type'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setValueType
(
$value_type
)
{
public
function
setValueType
(
$value_type
)
:
static
{
return
$this
->
set
(
'value_type'
,
$value_type
);
}
/**
* {@inheritdoc}
*/
public
function
getOwner
()
{
public
function
getOwner
()
:
UserInterface
{
return
$this
->
get
(
'user_id'
)
->
entity
;
}
/**
* {@inheritdoc}
*/
public
function
setOwner
(
UserInterface
$account
)
{
$this
->
set
(
'user_id'
,
$account
->
id
());
return
$this
;
public
function
setOwner
(
UserInterface
$account
):
static
{
return
$this
->
set
(
'user_id'
,
$account
->
id
());
}
/**
* {@inheritdoc}
*/
public
function
getOwnerId
()
{
return
$this
->
get
(
'user_id'
)
->
target_id
;
public
function
getOwnerId
()
:
int
|
null
{
return
(
int
)
$this
->
get
(
'user_id'
)
->
target_id
;
}
/**
* {@inheritdoc}
*/
public
function
setOwnerId
(
$uid
)
{
$this
->
set
(
'user_id'
,
$uid
);
return
$this
;
return
$this
->
set
(
'user_id'
,
$uid
);
}
/**
* {@inheritdoc}
*/
public
function
getCreatedTime
()
{
public
function
getCreatedTime
()
:
int
{
return
$this
->
get
(
'timestamp'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setCreatedTime
(
$timestamp
)
{
public
function
setCreatedTime
(
int
$timestamp
)
:
static
{
return
$this
->
set
(
'timestamp'
,
$timestamp
);
}
/**
* {@inheritdoc}
*/
public
function
getSource
()
{
public
function
getSource
()
:
string
{
return
$this
->
get
(
'vote_source'
)
->
value
;
}
/**
* {@inheritdoc}
*/
public
function
setSource
(
$source
)
{
public
function
setSource
(
string
$source
)
:
static
{
return
$this
->
set
(
'vote_source'
,
$source
);
}
/**
* {@inheritdoc}
*/
public
static
function
baseFieldDefinitions
(
EntityTypeInterface
$entity_type
)
{
public
static
function
baseFieldDefinitions
(
EntityTypeInterface
$entity_type
)
:
array
{
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
$fields
[
'id'
]
=
BaseFieldDefinition
::
create
(
'integer'
)
->
setLabel
(
new
TranslatableMarkup
(
'ID'
))
->
setDescription
(
new
TranslatableMarkup
(
'The vote ID.'
))
Loading