Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
integer_to_decimal
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
integer_to_decimal
Commits
df405a88
Commit
df405a88
authored
10 months ago
by
Michael Mwebaze
Browse files
Options
Downloads
Patches
Plain Diff
fixing phpcs related issues
parent
96f9b962
Branches
2.0.x
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#231786
passed with warnings
10 months ago
Stage: build
Stage: validate
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Service/FieldUpdaterService.php
+18
-0
18 additions, 0 deletions
src/Service/FieldUpdaterService.php
src/Service/FieldUpdaterServiceInterface.php
+3
-4
3 additions, 4 deletions
src/Service/FieldUpdaterServiceInterface.php
src/Util/EntityFromUri.php
+10
-6
10 additions, 6 deletions
src/Util/EntityFromUri.php
with
31 additions
and
10 deletions
src/Service/FieldUpdaterService.php
+
18
−
0
View file @
df405a88
...
...
@@ -21,20 +21,38 @@ use Drupal\Core\Config\ConfigFactoryInterface;
*/
class
FieldUpdaterService
implements
FieldUpdaterServiceInterface
{
use
StringTranslationTrait
;
/** @var EntityTypeManagerInterface */
protected
EntityTypeManagerInterface
$entityTypeManager
;
/** @var Connection */
protected
Connection
$connection
;
/** @var ConfigFactoryInterface */
protected
ConfigFactoryInterface
$configFactory
;
/** @var MessengerInterface */
protected
MessengerInterface
$messenger
;
/** @var EntityFieldManagerInterface */
protected
EntityFieldManagerInterface
$entityFieldManager
;
/**
* FieldUpdaterService constructor.
*
* @param Connection $connection
* The database connection service.
*
* @param EntityTypeManagerInterface $entityTypeManager
* The entity type manager service interface.
*
* @param ConfigFactoryInterface $configFactory
* The config factory service interface.
*
* @param MessengerInterface $messenger
* The messenger service interface.
*
* @param EntityFieldManagerInterface $entityFieldManager
* The entity field manager service interface.
*/
public
function
__construct
(
Connection
$connection
,
EntityTypeManagerInterface
$entityTypeManager
,
ConfigFactoryInterface
$configFactory
,
MessengerInterface
$messenger
,
EntityFieldManagerInterface
$entityFieldManager
)
{
...
...
This diff is collapsed.
Click to expand it.
src/Service/FieldUpdaterServiceInterface.php
+
3
−
4
View file @
df405a88
...
...
@@ -5,13 +5,12 @@ namespace Drupal\integer_to_decimal\Service;
use
Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
;
/**
*
p
rovides an interface for Field Updater services.
*
P
rovides an interface for Field Updater services.
*
*/
interface
FieldUpdaterServiceInterface
{
interface
FieldUpdaterServiceInterface
{
/**
* Updates a given field with the new precision and scale.
*
* @param string $field
* Machine name of the field
...
...
This diff is collapsed.
Click to expand it.
src/Util/EntityFromUri.php
+
10
−
6
View file @
df405a88
...
...
@@ -3,26 +3,30 @@
namespace
Drupal\integer_to_decimal\Util
;
/**
* A utility class that extracts the content type from the url
* A utility class that extracts the content type from the url
.
*
* @package Drupal\field_updater\Util
*/
class
EntityFromUri
{
class
EntityFromUri
{
/**
* Gets the current entity type for the URI.
*
* @return string id of the bundle or content type
*/
public
static
function
currentUriEntity
()
public
static
function
currentUriEntity
()
:
string
{
$currentUri
=
\Drupal
::
request
()
->
getRequestUri
();
return
explode
(
'/'
,
$currentUri
)[
5
];
}
/**
* Gets the field from URI.
*
* @return string field name being updated from integer to decimal
*/
public
static
function
currentUriField
(){
public
static
function
currentUriField
():
string
{
$currentUri
=
\Drupal
::
request
()
->
getRequestUri
();
return
explode
(
'.'
,
explode
(
'/'
,
$currentUri
)[
7
])[
2
];
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment