Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
import
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lib
unicaen
import
Commits
547f6954
Commit
547f6954
authored
3 years ago
by
Laurent Lecluse
Browse files
Options
Downloads
Patches
Plain Diff
Nouvelle méthode isImportedProperty
parent
01b49a83
No related branches found
No related tags found
No related merge requests found
Pipeline
#18127
passed
2 years ago
Stage: publish
Changes
1
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Service/SchemaService.php
+28
-8
28 additions, 8 deletions
src/Service/SchemaService.php
with
28 additions
and
8 deletions
src/Service/SchemaService.php
+
28
−
8
View file @
547f6954
...
...
@@ -147,7 +147,7 @@ class SchemaService extends AbstractService
*
* @return string[]
*/
public
function
getImportViews
()
public
function
getImportViews
()
:
array
{
$sql
=
"SELECT view_name FROM USER_VIEWS WHERE view_name LIKE 'SRC_%'"
;
$stmt
=
$this
->
getEntityManager
()
->
getConnection
()
->
query
(
$sql
);
...
...
@@ -167,7 +167,7 @@ class SchemaService extends AbstractService
* @param string $tableName
* @param string $columnName
*/
public
function
hasColumn
(
$tableName
,
$columnName
)
public
function
hasColumn
(
string
$tableName
,
string
$columnName
)
:
bool
{
$sql
=
"
SELECT
...
...
@@ -188,7 +188,7 @@ class SchemaService extends AbstractService
/**
* Retourne les colonnes concernées par l'import pour une table donnée
*/
public
function
getImportCols
(
$tableName
)
public
function
getImportCols
(
$tableName
)
:
array
{
if
(
!
array_key_exists
(
$tableName
,
$this
->
importColsCache
))
{
$sql
=
"
...
...
@@ -216,18 +216,18 @@ class SchemaService extends AbstractService
/**
* Détecte si une propriété d'une classe est importable ou non
*
* @param
string|\stdClass $className
* @param
object|string $entity
* @param string $fieldName
*
* @return bool
*/
public
function
isImportedProperty
(
$className
,
string
$fieldName
):
bool
public
function
isImportedProperty
(
object
|
string
$entity
,
string
$fieldName
):
bool
{
if
(
is_object
(
$
className
)){
$
className
=
get_class
(
$
className
);
if
(
is_object
(
$
entity
)){
$
entity
=
get_class
(
$
entity
);
}
$metadata
=
$this
->
getEntityManager
()
->
getClassMetadata
(
$
className
);
$metadata
=
$this
->
getEntityManager
()
->
getClassMetadata
(
$
entity
);
$tableName
=
$metadata
->
getTableName
();
...
...
@@ -242,4 +242,24 @@ class SchemaService extends AbstractService
return
in_array
(
$columnName
,
$importCols
);
}
/**
* @param object|string $entity
*
* @return bool
*/
public
function
isImportedEntity
(
object
|
string
$entity
):
bool
{
if
(
is_object
(
$entity
)){
$entity
=
get_class
(
$entity
);
}
$metadata
=
$this
->
getEntityManager
()
->
getClassMetadata
(
$entity
);
$tableName
=
$metadata
->
getTableName
();
return
in_array
(
$tableName
,
$this
->
getImportTables
());
}
}
\ 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