Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
MagicWord
Commits
f4f63f3a
Commit
f4f63f3a
authored
May 28, 2019
by
Arnaud Bey
Browse files
remove fulltext index search
parent
573622c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
application/src/LexiconBundle/Manager/WordManager.php
View file @
f4f63f3a
...
...
@@ -53,7 +53,7 @@ class WordManager
{
$languageId
=
$language
->
getId
();
foreach
(
$wordStarts
as
$wordStartValue
)
{
if
(
!
$found
=
$this
->
em
->
getRepository
(
WordStart
::
class
)
->
search
(
$wordStartValue
,
$languageId
))
{
if
(
!
$found
=
$this
->
em
->
getRepository
(
WordStart
::
class
)
->
findOneBy
([
"language"
=>
$language
,
"value"
=>
$wordStartValue
]
))
{
$wordStart
=
new
WordStart
;
$wordStart
->
setLanguage
(
$languageId
);
$wordStart
->
setValue
(
$wordStartValue
);
...
...
application/src/LexiconBundle/Repository/WordStartRepository.php
View file @
f4f63f3a
...
...
@@ -9,20 +9,6 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
class
WordStartRepository
extends
\
Doctrine\ORM\EntityRepository
{
public
function
search
(
$start
,
$languageId
)
{
$sql
=
"SELECT 1 FROM lexicon_word_start WHERE MATCH(value) AGAINST ('"
.
$start
.
"' IN NATURAL LANGUAGE MODE) AND language = "
.
$languageId
;
$em
=
$this
->
_em
;
$stmt
=
$em
->
getConnection
()
->
prepare
(
$sql
);
$stmt
->
execute
();
if
(
!
empty
(
$stmt
->
fetchAll
()))
{
return
true
;
};
return
false
;
}
public
function
deleteByLanguage
(
$language
)
{
return
$this
->
createQueryBuilder
(
'ws'
)
...
...
@@ -30,8 +16,7 @@ class WordStartRepository extends \Doctrine\ORM\EntityRepository
->
andWhere
(
'ws.language = :val'
)
->
setParameter
(
'val'
,
$language
)
->
getQuery
()
->
getResult
()
;
->
getResult
();
}
public
function
countAllByLanguage
(
Language
$language
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment