Advanced usage: example with Doctrine

That's not really an advanced topic, but the sample will be a bit hard to read (as it takes many files), so let's say it targets more experienced Symfony users.

In this demo, we're displaying a MyArray of MyElements, both persisted into the database. The MyArray entity only have an id and a name, and MyElement has id, MyArray's id and a value. This is quite the same as we seen in all demos, but persisted.

Array name:
Add an element...

Existing arrays:
Name Open Delete
name}) }} Open Delete
___ ☘ Cela fonctionne ☘ Open Delete
___ ☘ Cela fonctionne à Open Delete
___ ☘ Cela fonctionne ☠Open Delete
_____ Open Delete
__________________________________________ Open Delete
____________________________1 test Open Delete
_______aaaazz Open Delete
___%20%C3%83%C2%A2%C3%82%C2%98%C3%82%C2%98%20Cela%20fonctionne%20%C3%83 Open Delete
___%20%C3%83%C2%A2%C3%82%C2%98%C3%82%C2%98%20Cela%20fonctionne%20%C3%83%C2%A2%C3%82%C2%98%C3%82%C2%98 Open Delete
__EDLP_7-0_ Open Delete
_a_firra Open Delete
Open Delete
--- Open Delete
---#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
---#i27992875ec4286a24e569b1e015b0473 Open Delete
---#ie025efbbb0738ed01a63b326c174233e Open Delete
!! Open Delete
? Open Delete
' Open Delete
(orphée) Open Delete
(SELECT (CASE WHEN (9680=8265) THEN 'kjh' ELSE (SELECT 8265 UNION SELECT 7356) END)) Open Delete
@12 Open Delete
#456 Open Delete
#72uuuu Open Delete
#91 Open Delete
#AlgoSucks Open Delete
%231 Open Delete
%2372 Open Delete
%2372uuuuokokok Open Delete
%25237233333 Open Delete
%25237233333#i21ef661e2506d5d0e513dce166c17d49 Open Delete
%25237233333#i27992875ec4286a24e569b1e015b0473 Open Delete
%25237233333#i5784b3886628c4362594ffa43547edb4 Open Delete
%252372uuuu#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
%252372uuuu#i21ef661e2506d5d0e513dce166c17d49 Open Delete
%252372uuuu#i27992875ec4286a24e569b1e015b0473 Open Delete
%252372uuuu#i5784b3886628c4362594ffa43547edb4 Open Delete
%252372uuuu#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
%252372uuuu#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
%252372uuuu#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
%252372uuuu#ie025efbbb0738ed01a63b326c174233e Open Delete
%252391 Open Delete
%25253F%23i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
%253F Open Delete
%253F#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
%253F#i21ef661e2506d5d0e513dce166c17d49 Open Delete
%253F#i27992875ec4286a24e569b1e015b0473 Open Delete
%253F#i5784b3886628c4362594ffa43547edb4 Open Delete
%253F#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
%253F#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
%253F#ie025efbbb0738ed01a63b326c174233e Open Delete
%27 Open Delete
%28orph%C3%A9e%29 Open Delete
%28SELECT%20%28CASE%20WHEN%20%283158=3158%29%20THEN%20%27kjh%27%20ELSE%20%28SELECT%201437%20UNION%20SELECT%202166%29%20END%29%29 Open Delete
%28SELECT%20%28CASE%20WHEN%20%284626=9556%29%20THEN%20%27kjh%27%20ELSE%20%28SELECT%209556%20UNION%20SELECT%209237%29%20END%29%29 Open Delete
%C3%83%C2%83%C3%82%C2%83%C3%83%C2%82%C3%82%C2%B1lkjlkj Open Delete
%C3%83%C2%B1lkjlkj Open Delete
%C3%A2%C2%98%C2%98%20Cela%20fonctionne%20%C3%A2%C2%98%C2%98 Open Delete
<script>alert('test')</script> Open Delete
<script>alert('test')</script>%n%n%n%n%n%n Open Delete
<script>alert('test')</script>%n%n%n%n%n%n<script>alert('test')</script>%n%n%n%n%n%n<script>alert('test')</script>%n%n%n%n%n%n<script>alert('test')</script>%n%n%n%n%n%n<script>alert('test')</script>%n%n%n%n%n%n<script>alert('test')</script>%n%n%n%n%n%n<sc Open Delete
<sdsads Open Delete
~~~ Open Delete
1 Open Delete
10 Open Delete
1000-1 Open Delete
11#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
11#i21ef661e2506d5d0e513dce166c17d49 Open Delete
11#i27992875ec4286a24e569b1e015b0473 Open Delete
11#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
1111 Open Delete
1111#ie025efbbb0738ed01a63b326c174233e Open Delete
1111%23i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
11111 Open Delete
1111111111111111111111111111111111#i27992875ec4286a24e569b1e015b0473 Open Delete
1111111111111111111111111111111111#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
1111111111111111111111111111111111#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
1111Yapi Open Delete
1121 Open Delete
12 Open Delete
122 Open Delete
123 Open Delete
1231 Open Delete
123123 Open Delete
123333 Open Delete
12345 Open Delete
1241 Open Delete
1525 Open Delete
1aa Open Delete
1Alpha Open Delete
2' Open Delete
222 Open Delete
2222%20example Open Delete
222222 Open Delete
2323 Open Delete
2344234 Open Delete
3 Open Delete
33 Open Delete
454 Open Delete
4545 Open Delete
456 Open Delete
5 Open Delete
63 Open Delete
78 Open Delete
88 Open Delete
8889 Open Delete
8899 Open Delete
890 Open Delete
ñlkjlkj Open Delete
ñsfkjaldsa Open Delete
aaaa Open Delete
ñsfkjaldsa Open Delete
aaaaaaa Open Delete
aaaaaaaaaaaaaa22 Open Delete
AAAAAAAAAAAAAAAAAAAAA Open Delete
AAAAAEER Open Delete
aaamine22222#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
aaamine22222#i5784b3886628c4362594ffa43547edb4 Open Delete
aaamine22222#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
Abc1 Open Delete
ad Open Delete
Addresses Open Delete
adfadf'A=0 Open Delete
adrian Open Delete
adsada Open Delete
aee Open Delete
any Open Delete
Array Open Delete
array new Open Delete
array1 Open Delete
arrayGilmry Open Delete
articulo Open Delete
asD Open Delete
asd asd asd Open Delete
asda Open Delete
asdasd#i21ef661e2506d5d0e513dce166c17d49 Open Delete
asdasd#i27992875ec4286a24e569b1e015b0473 Open Delete
asdasd#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
asdasd#ie025efbbb0738ed01a63b326c174233e Open Delete
asdasd%23i5784b3886628c4362594ffa43547edb4 Open Delete
asdasd%23ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
asdasdadasd#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
asdasdadasd#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
asdasdadasd#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
asdasdadasd#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
asdasdasd Open Delete
asdf Open Delete
asdfasdfasd Open Delete
asdfasdfasd8888 Open Delete
AU Open Delete
azerty Open Delete
azerty'A=0 Open Delete
b Open Delete
balala Open Delete
bbbbbbbbbbbbbbbb Open Delete
bdfdfdfdf Open Delete
bite Open Delete
bjfhj Open Delete
bjfhj#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
bjfhj#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
bjfhj#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
bla Open Delete
blah#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
blah#i21ef661e2506d5d0e513dce166c17d49 Open Delete
blah#i5784b3886628c4362594ffa43547edb4 Open Delete
blah#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
blah#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
blah#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
born Open Delete
Bra Open Delete
caracas Open Delete
cdcdc Open Delete
cela Open Delete
Cela fonctionne Open Delete
Cela fonctionne pas Open Delete
Cmucik Open Delete
colombo Open Delete
cxcxx Open Delete
D Open Delete
D happy 2018 Open Delete
D#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
D#i27992875ec4286a24e569b1e015b0473 Open Delete
D#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
D#ie025efbbb0738ed01a63b326c174233e Open Delete
dadd Open Delete
das Open Delete
dasf Open Delete
ddddd Open Delete
dddddddddddddddddddddd Open Delete
delete_empty Open Delete
demo Open Delete
dfa#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
dfa#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
dfa#i27992875ec4286a24e569b1e015b0473 Open Delete
dfa#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
dfa%23i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
dfdsf Open Delete
dfg Open Delete
dfsdf Open Delete
dfty Open Delete
dgdgdg Open Delete
dgh Open Delete
diarill Open Delete
diego Open Delete
Doom Open Delete
drgd Open Delete
dsadsadd Open Delete
dsd Open Delete
dsdfgsdfgdf Open Delete
dsf Open Delete
dsfdsfd Open Delete
dsfsdfs Open Delete
dsvfdsfg] Open Delete
dsvfdsfg%5D Open Delete
e Open Delete
eeeeee Open Delete
ejemplo 2017 Open Delete
eqweqwe Open Delete
ewe Open Delete
exadasdas Open Delete
example Delete
example.0 Open Delete
example%20exam Open Delete
example%2520exam Open Delete
example+exam Open Delete
example123 Open Delete
example123#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
example123#i21ef661e2506d5d0e513dce166c17d49 Open Delete
example123#i27992875ec4286a24e569b1e015b0473 Open Delete
example123#i5784b3886628c4362594ffa43547edb4 Open Delete
example123#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
example123#ie025efbbb0738ed01a63b326c174233e Open Delete
example123%23ie025efbbb0738ed01a63b326c174233e Open Delete
example33333 Open Delete
example4 Open Delete
exampleasfsafa Open Delete
exampleasfsafasf#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
exampleasfsafasf#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
exampleasfsafasf#i21ef661e2506d5d0e513dce166c17d49 Open Delete
exampleasfsafasf#i27992875ec4286a24e569b1e015b0473 Open Delete
exampleasfsafasf#i5784b3886628c4362594ffa43547edb4 Open Delete
exampleasfsafasf%23i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
exampledsdsdd Open Delete
exampledsdsdda Open Delete
examplee Open Delete
exampleede Open Delete
exampleeeeeeeeeeeee Open Delete
examplejjj Open Delete
examplenhnhd Open Delete
exampleqqqq Open Delete
exampleRW Open Delete
examplesa;fs;af;sfsf Open Delete
examplesafs;af;sfsf Open Delete
examplesafsaf Open Delete
examplesafsaf;sfsf Open Delete
examplesdddd Open Delete
exampless Open Delete
exampletes Open Delete
exampletest_11 Open Delete
exampleu Open Delete
examplew Open Delete
examqdqsple Open Delete
Existing%20arrays: Open Delete
Existing%2520arrays: Open Delete
exkiample Open Delete
fasdfasf Open Delete
fdf#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
fdf#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
fdf#i27992875ec4286a24e569b1e015b0473 Open Delete
fdf#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
fdf#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
fdf#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
fdf#ie025efbbb0738ed01a63b326c174233e Open Delete
fdf%23i27992875ec4286a24e569b1e015b0473 Open Delete
fdg Open Delete
fdgdf Open Delete
fdsfds Open Delete
ff d Open Delete
ffff Open Delete
fg Open Delete
fgdfg Open Delete
fgdfgfg Open Delete
fgfdgfdgdg Open Delete
fghjkl Open Delete
firrra Open Delete
foo Open Delete
Fora Bolsonaro Open Delete
fsda Open Delete
fsdfd Open Delete
fsdfsdf Open Delete
fuck you Open Delete
gdfg#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
gdfg#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
gdfg#i27992875ec4286a24e569b1e015b0473 Open Delete
gdfg#i5784b3886628c4362594ffa43547edb4 Open Delete
gdfg#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
gege Open Delete
geht nicht Open Delete
gfgddgfd Open Delete
gg'A=0 Open Delete
ghfhgfg Open Delete
ghgtytyt Open Delete
ghj Open Delete
ghjk#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
ghjk#i21ef661e2506d5d0e513dce166c17d49 Open Delete
ghjk#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
ghkjgykg Open Delete
Ghy Open Delete
Group B Open Delete
Group%252BC Open Delete
Group%2BC#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
Group%2BC#i21ef661e2506d5d0e513dce166c17d49 Open Delete
Group%2BC#i27992875ec4286a24e569b1e015b0473 Open Delete
Group%2BC#i5784b3886628c4362594ffa43547edb4 Open Delete
Group%2BC#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
Group%2BC#ie025efbbb0738ed01a63b326c174233e Open Delete
gtgt Open Delete
hb Open Delete
hbhbhb Open Delete
hello Open Delete
Hello world Open Delete
Hello%2520World%2520! Open Delete
hellowrld Open Delete
HEYY :D Open Delete
HEYY%2520:D Open Delete
HEYY%2520:D#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
HEYY%2520:D#i21ef661e2506d5d0e513dce166c17d49 Open Delete
HEYY%2520:D#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
HEYY%2520:D#ie025efbbb0738ed01a63b326c174233e Open Delete
HEYY%252520:D%23ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
hg Open Delete
hgjgjh Open Delete
hjvhj Open Delete
ho Open Delete
hoho Open Delete
htrhrh Open Delete
ilesh Open Delete
interest Open Delete
iujjj Open Delete
j Open Delete
jb Open Delete
jghjghjgj Open Delete
jhj Open Delete
jk Open Delete
jkjk Open Delete
julio Open Delete
kaas Open Delete
khj#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
khj#i27992875ec4286a24e569b1e015b0473 Open Delete
khj%23i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
kiki Open Delete
kjh AND 2060=2060 Open Delete
kjh AND 2060=2060-- Qbuj Open Delete
kjh AND 2171=2112-- yWqk Open Delete
kjh AND 4281=2310-- NRaM Open Delete
kjh AND 7390 IN (SELECT (CHAR(113)+CHAR(106)+CHAR(106)+CHAR(118)+CHAR(113)+(SELECT (CASE WHEN (7390=7390) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(113)+CHAR(122)+CHAR(120)+CHAR(113)))-- iTwS Open Delete
kjh AND 7954=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(122)||CHR(107)||CHR(120)||CHR(113)||(SELECT (CASE WHEN (7954=7954) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(106)||CHR(107)||CHR(122)||CHR(113)||CHR(62))) FROM DUAL) Open Delete
kjh AND 8611=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(106)||CHR(106)||CHR(118)||CHR(113)||(SELECT (CASE WHEN (8611=8611) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(113)||CHR(122)||CHR(120)||CHR(113)||CHR(62))) FROM DUAL) Open Delete
kjh AND 8611=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(106)||CHR(106)||CHR(118)||CHR(113)||(SELECT (CASE WHEN (8611=8611) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(113)||CHR(122)||CHR(120)||CHR(113)||CHR(62))) FROM DUAL)-- iQEG Open Delete
kjh AND 8864=CAST((CHR(113)||CHR(122)||CHR(107)||CHR(120)||CHR(113))||(SELECT (CASE WHEN (8864=8864) THEN 1 ELSE 0 END))::text||(CHR(113)||CHR(106)||CHR(107)||CHR(122)||CHR(113)) AS NUMERIC)-- XVww Open Delete
kjh AND 9650=6116 Open Delete
kjh AND 9667 IN (SELECT (CHAR(113)+CHAR(122)+CHAR(107)+CHAR(120)+CHAR(113)+(SELECT (CASE WHEN (9667=9667) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(106)+CHAR(107)+CHAR(122)+CHAR(113))) Open Delete
kjh AND 9667 IN (SELECT (CHAR(113)+CHAR(122)+CHAR(107)+CHAR(120)+CHAR(113)+(SELECT (CASE WHEN (9667=9667) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(106)+CHAR(107)+CHAR(122)+CHAR(113)))-- IHOP Open Delete
kjh,),..('") Open Delete
kjh,),..('"). Open Delete
kjh' AND 2060=2060 AND 'JKZh'='JKZh Open Delete
kjh' AND 7390 IN (SELECT (CHAR(113)+CHAR(106)+CHAR(106)+CHAR(118)+CHAR(113)+(SELECT (CASE WHEN (7390=7390) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(113)+CHAR(122)+CHAR(120)+CHAR(113))) AND 'pbYL'='pbYL Open Delete
kjh' AND 7954=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(122)||CHR(107)||CHR(120)||CHR(113)||(SELECT (CASE WHEN (7954=7954) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(106)||CHR(107)||CHR(122)||CHR(113)||CHR(62))) FROM DUAL) AND 'HwZm'='HwZm Open Delete
kjh' AND 8611=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(106)||CHR(106)||CHR(118)||CHR(113)||(SELECT (CASE WHEN (8611=8611) THEN 1 ELSE 0 END) FRO Open Delete
kjh' AND 8864=CAST((CHR(113)||CHR(122)||CHR(107)||CHR(120)||CHR(113))||(SELECT (CASE WHEN (8864=8864) THEN 1 ELSE 0 END))::text||(CHR(113)||CHR(106)||CHR(107)||CHR(122)||CHR(113)) AS NUMERIC) AND 'HQRy'='HQRy Open Delete
kjh' AND 9667 IN (SELECT (CHAR(113)+CHAR(122)+CHAR(107)+CHAR(120)+CHAR(113)+(SELECT (CASE WHEN (9667=9667) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(106)+CHAR(107)+CHAR(122)+CHAR(113))) AND 'mDsE'='mDsE Open Delete
kjh') AND 2060=2060 AND ('JwAk'='JwAk Open Delete
kjh') AND 2750=5826 AND ('NRcI'='NRcI Open Delete
kjh') AND 6285=CAST((CHR(113)||CHR(106)||CHR(106)||CHR(118)||CHR(113))||(SELECT (CASE WHEN (6285=6285) THEN 1 ELSE 0 END))::text||(CHR(113)||CHR(113)||CHR(122)||CHR(120)||CHR(113)) AS NUMERIC) AND ('bnAs'='bnAs Open Delete
kjh') AND 7426=7426 AND ('cRTV'='cRTV Open Delete
kjh') AND 8611=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(106)||CHR(106)||CHR(118)||CHR(113)||(SELECT (CASE WHEN (8611=8611) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(113)||CHR(122)||CHR(120)||CHR(113)||CHR(62))) FROM DUAL) AND ('drpH'='drpH Open Delete
kjh') AND EXTRACTVALUE(5914,CONCAT(0x5c,0x716a6a7671,(SELECT (ELT(5914=5914,1))),0x71717a7871)) AND ('GoTE'='GoTE Open Delete
kjh') AND EXTRACTVALUE(7241,CONCAT(0x5c,0x717a6b7871,(SELECT (ELT(7241=7241,1))),0x716a6b7a71)) AND ('oZSA'='oZSA Open Delete
kjh') ORDER BY 1-- osYG Open Delete
kjh'vKJjiT<'">dxPGFb Open Delete
kjh) AND 1607=1768 AND (8263=8263 Open Delete
kjh) AND 2060=2060 AND (3370=3370 Open Delete
kjh) AND 7954=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(122)||CHR(107)||CHR(120)||CHR(113)||(SELECT (CASE WHEN (7954=7954) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(106)||CHR(107)||CHR(122)||CHR(113)||CHR(62))) FROM DUAL) AND (2635=2635 Open Delete
kjh) AND 8611=(SELECT UPPER(XMLType(CHR(60)||CHR(58)||CHR(113)||CHR(106)||CHR(106)||CHR(118)||CHR(113)||(SELECT (CASE WHEN (8611=8611) THEN 1 ELSE 0 END) FROM DUAL)||CHR(113)||CHR(113)||CHR(122)||CHR(120)||CHR(113)||CHR(62))) FROM DUAL) AND (7499=7499 Open Delete
kjh) AND 9667 IN (SELECT (CHAR(113)+CHAR(122)+CHAR(107)+CHAR(120)+CHAR(113)+(SELECT (CASE WHEN (9667=9667) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(106)+CHAR(107)+CHAR(122)+CHAR(113))) AND (2205=2205 Open Delete
kjh) AND 9930=6330 AND (9057=9057 Open Delete
kjh) AND EXTRACTVALUE(5914,CONCAT(0x5c,0x716a6a7671,(SELECT (ELT(5914=5914,1))),0x71717a7871)) AND (9337=9337 Open Delete
kjh) AND EXTRACTVALUE(7241,CONCAT(0x5c,0x717a6b7871,(SELECT (ELT(7241=7241,1))),0x716a6b7a71)) AND (6110=6110 Open Delete
kjh%20AND%207954=%28SELECT%20UPPER%28XMLType%28CHR%2860%29%7C%7CCHR%2858%29%7C%7CCHR%28113%29%7C%7CCHR%28122%29%7C%7CCHR%28107%29%7C%7CCHR%28120%29%7C%7CCHR%28113%29%7C%7C%28SELECT%20%28CASE%20WHEN%20%287954=7954%29%20THEN%201%20ELSE%200%20END%29%20FROM%2 Open Delete
kjh%20AND%20EXTRACTVALUE%287241,CONCAT%280x5c,0x717a6b7871,%28SELECT%20%28ELT%287241=7241,1%29%29%29,0x716a6b7a71%29%29 Open Delete
kjh%27%29%20AND%20EXTRACTVALUE%287241,CONCAT%280x5c,0x717a6b7871,%28SELECT%20%28ELT%287241=7241,1%29%29%29,0x716a6b7a71%29%29%20AND%20%28%27oZSA%27=%27oZSA Open Delete
kjh%27FIFazt%3C%27%22%3EkJJxrd Open Delete
kjh%29%20AND%209930=6330%20AND%20%289057=9057 Open Delete
kjkjkj Open Delete
kjkk Open Delete
kk Open Delete
kkk#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
kkk#i21ef661e2506d5d0e513dce166c17d49 Open Delete
kkk#i27992875ec4286a24e569b1e015b0473 Open Delete
kkk#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
klk Open Delete
klklklkl Open Delete
kmkm Open Delete
kool Open Delete
kpok Open Delete
kpok%C3%82%C2%B4p Open Delete
kpok´p Open Delete
lj Open Delete
ll Open Delete
lol Open Delete
lolo Open Delete
m Open Delete
mec Open Delete
Memes Open Delete
mjn Open Delete
mmm Open Delete
moi Open Delete
moiGHOY - Resources/views/Advanced/doctrine-them Open Delete
mon tableau Open Delete
mon%20exemple Open Delete
mon%20putain%20de%20tableau Open Delete
mt Open Delete
name Open Delete
nbnv Open Delete
new Open Delete
New Array Open Delete
new test Open Delete
New_test_2017- Open Delete
new%2520test Open Delete
ñlkjlkj Open Delete
nmn#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
nmn#i21ef661e2506d5d0e513dce166c17d49 Open Delete
nmn#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
nmn#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
nmn%23i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
nmn%23i27992875ec4286a24e569b1e015b0473 Open Delete
nnn Open Delete
Numeros de prueba Open Delete
o Open Delete
o%C3%83%C2%83%C3%82%C2%84%C3%83%C2%82%C3%82%C2%B1 Open Delete
o%C4%B1 Open Delete
oı Open Delete
oezjfez Open Delete
oij Open Delete
ojkj Open Delete
ok Open Delete
okilol Open Delete
olaboga Open Delete
ordersCollection Open Delete
oui Open Delete
Ouiiiiiiiiiiii Open Delete
Ouiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii Open Delete
Ouiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii Open Delete
Ouiiiiiiiiiiiiiiiiiiiiiiiilul Open Delete
ouiou Open Delete
pablo Open Delete
Pepa Open Delete
pepiii Open Delete
peppo Open Delete
perebetes Open Delete
perses Open Delete
perses#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
perses#i21ef661e2506d5d0e513dce166c17d49 Open Delete
perses#i5784b3886628c4362594ffa43547edb4 Open Delete
perses#ie025efbbb0738ed01a63b326c174233e Open Delete
pornhub.com Open Delete
pp Open Delete
pppppii#i21ef661e2506d5d0e513dce166c17d49 Open Delete
pppppii#i5784b3886628c4362594ffa43547edb4 Open Delete
pppppii#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
pppppii#ie025efbbb0738ed01a63b326c174233e Open Delete
pppppp Open Delete
Premier element de test Open Delete
Product Open Delete
project%201 Open Delete
qe Open Delete
quantite --1 Open Delete
qwehgnhngh Open Delete
r Open Delete
rar Open Delete
rdfgdf Open Delete
RET Open Delete
rrrr#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
rrrr#i21ef661e2506d5d0e513dce166c17d49 Open Delete
rrrr#i27992875ec4286a24e569b1e015b0473 Open Delete
rrrr#i5784b3886628c4362594ffa43547edb4 Open Delete
rrrr#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
rrrr#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
rrrr#ie025efbbb0738ed01a63b326c174233e Open Delete
rrrr%23i27992875ec4286a24e569b1e015b0473 Open Delete
RV Open Delete
ryhre Open Delete
s Open Delete
sa Open Delete
saASD Open Delete
saassa Open Delete
salut les Open Delete
salut%20les%20gens Open Delete
samArray Open Delete
sami Open Delete
sample Open Delete
sasa Open Delete
scts Open Delete
sd Open Delete
sdasdafs Open Delete
sdczsdzsd Open Delete
sdf Open Delete
sdfsdf Open Delete
sdg Open Delete
sdsd'A=0 Open Delete
sdsd%27A=0 Open Delete
seeme Open Delete
seeme#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
seeme#i27992875ec4286a24e569b1e015b0473 Open Delete
seeme#i5784b3886628c4362594ffa43547edb4 Open Delete
seeme#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
seeme#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
seeme#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
seeme#ie025efbbb0738ed01a63b326c174233e Open Delete
seeme%23i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
sfsa Open Delete
sfsdfsd Open Delete
sgdfs Open Delete
some new array Open Delete
someNewArray Open Delete
someNewArray#i21ef661e2506d5d0e513dce166c17d49 Open Delete
someNewArray#i27992875ec4286a24e569b1e015b0473 Open Delete
someNewArray#ic3ee8978c60737ab5d058b5a3f6a1b09 Open Delete
sqd Open Delete
ss Open Delete
ssssssssssssss Open Delete
Starojitski Open Delete
suck my co Open Delete
t Open Delete
t11 Open Delete
Ta mere la Open Delete
Ta%20mere%20la%20grosse%20choin Open Delete
Ta%2520mere%2520la%2520grosse%2520choin Open Delete
Ta%2520mere%2520la%2520grosse%2520choin#i1097c8b84b58a65ed6ec7b4f0da3ab67 Open Delete
Ta%2520mere%2520la%2520grosse%2520choin#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
Ta%2520mere%2520la%2520grosse%2520choin#i21ef661e2506d5d0e513dce166c17d49 Open Delete
Ta%2520mere%2520la%2520grosse%2520choin#i27992875ec4286a24e569b1e015b0473 Open Delete
Ta%2520mere%2520la%2520grosse%2520choin#i8c18088ea4d8dd4d6e5e986bceed35da Open Delete
Ta%252520mere%252520la%252520grosse%252520choin%23i21ef661e2506d5d0e513dce166c17d49 Open Delete
TATA Open Delete
Telous Open Delete
tes Open Delete
tesr Open Delete
tesst Open Delete
Test Open Delete
TEST 2 Open Delete
test array Open Delete
test name Open Delete
test nours Open Delete
test--1 Open Delete
test%20array Open Delete
test34'A=0 Open Delete
teste Open Delete
testing Open Delete
testN17 Open Delete
Thais Open Delete
the Open Delete
the%20test Open Delete
the+test Open Delete
thhtrh Open Delete
This Open Delete
timo Open Delete
tojo Open Delete
toti Open Delete
trololo Open Delete
try01 Open Delete
tryy5 Open Delete
ttt Open Delete
tyty Open Delete
uiu Open Delete
uytuuyt Open Delete
Vai%2520que%2520da Open Delete
vcvcvcvcvv Open Delete
vh Open Delete
Volta Dilma Fora Temer Open Delete
Volta%20Di Open Delete
Volta%20Dilma%20Fora% Open Delete
Volta%2520Dilma%2520Fo Open Delete
Volta%2520Dilma%2520Fora% Open Delete
Volta%2520Dilma%2520Fora%2520Temer Open Delete
Volta%2520Dilma%2520Fora%2520Temer#i1dcd1cbb0d8eeb1fd3a32dc2aa9c8013 Open Delete
Volta%2520Dilma%2520Fora%2520Temer#i21ef661e2506d5d0e513dce16 Open Delete
Volta%2520Dilma%2520Fora%2520Temer#i21ef661e2506d5d0e513dce166c17d49 Open Delete
Volta%2520Dilma%2520Fora%2520Temer#i27992875ec4286a24e569b1e015b0473 Open Delete
Volta%2520Dilma%2520Fora%2520Temer#i5784b3886628c4362594ffa43547edb4 Open Delete
Volta%2520Dilma%2520Fora%2520Temer#ibcac9f4c58199eeaa7ba5c7750b8434b Open Delete
Volta+Dilma+Fora+Temer Open Delete
VRE Open Delete
vvvvvvvvvvvvvvv Open Delete
vxvxcvxcv Open Delete
w Open Delete
wasda Open Delete
why doctrine on delete not work Open Delete
why%20doctrine%20on%20delete%20not%20work Open Delete
why%20doctrine%20on%20delete%20not%20work%3F Open Delete
why%2520doctrine%2520on%2520delete%2520not%2520work%253F Open Delete
Woop wooop Open Delete
Woop% Open Delete
Woop%20wooop Open Delete
wqewqeqwewewq Open Delete
ww Open Delete
wxc%3Cwxc Open Delete
wxc<wxc Open Delete
xcxcxcx Open Delete
xy Open Delete
xzcvxcv Open Delete
yiktikrtr Open Delete
yytutyutyu Open Delete
zDSfsdf Open Delete
zizizizizi Open Delete
zzzz Open Delete
zzzzzz Open Delete
File: Base/BaseController.php
<?php

namespace Fuz\AppBundle\Base;

use Fuz\AppBundle\Entity\Value;
use Fuz\AppBundle\Form\ValueType;
use Fuz\QuickStartBundle\Base\BaseController as QuickStartBase;
use Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\HttpFoundation\Request;

class BaseController extends QuickStartBase
{
    protected function createContextSample(Request $request, $name = 'form', $values = ['a', 'b', 'c'])
    {
        $data = ['values' => $values];

        $form = $this
           ->get('form.factory')
           ->createNamedBuilder($name, Type\FormType::class, $data)
           ->add('values', Type\CollectionType::class, [
               'entry_type'    => Type\TextType::class,
               'label'         => 'Add, move, remove values and press Submit.',
               'entry_options' => [
                   'label' => 'Value',
               ],
               'allow_add'    => true,
               'allow_delete' => true,
               'prototype'    => true,
               'attr'         => [
                   'class' => "{$name}-collection",
               ],
           ])
           ->add('submit', Type\SubmitType::class)
           ->getForm()
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $data = $form->getData();
        }

        return [
            $name         => $form->createView(),
            "{$name}Data" => $data,
        ];
    }

    protected function createAdvancedContextSample(Request $request, $name = 'advancedForm')
    {
        $a = new Value('a');
        $b = new Value('b');
        $c = new Value('c');

        $data = ['values' => [$a, $b, $c]];

        $form = $this
           ->get('form.factory')
           ->createNamedBuilder($name, Type\FormType::class, $data)
           ->add('values', Type\CollectionType::class, [
               'entry_type'   => ValueType::class,
               'label'        => 'Add, move, remove values and press Submit.',
               'allow_add'    => true,
               'allow_delete' => true,
               'prototype'    => true,
               'required'     => false,
               'attr'         => [
                   'class' => "{$name}-collection",
               ],
           ])
           ->add('submit', Type\SubmitType::class)
           ->getForm()
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $data = $form->getData();
        }

        return [
            $name         => $form->createView(),
            "{$name}Data" => $data,
        ];
    }
}
File: Base/BaseController.php
File: Controller/AdvancedController.php
<?php

namespace Fuz\AppBundle\Controller;

use Fuz\AppBundle\Base\BaseController;
use Fuz\AppBundle\Entity\Address;
use Fuz\AppBundle\Entity\Addresses;
use Fuz\AppBundle\Entity\Fancy;
use Fuz\AppBundle\Entity\FancyCollection;
use Fuz\AppBundle\Entity\Value;
use Fuz\AppBundle\Form\AddressesType;
use Fuz\AppBundle\Form\FancyCollectionType;
use Fuz\AppBundle\Form\MyArrayType;
use Fuz\AppBundle\Form\ValueType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\HttpFoundation\Request;

/**
 * @Route("/advanced")
 */
class AdvancedController extends BaseController
{
    /**
     * Advanced usage
     *
     * You can reference your form collection in the view, instead of
     * putting a selector in the form type.
     *
     * @Route("/mvcCompliance", name="mvcCompliance")
     * @Template()
     */
    public function mvcComplianceAction(Request $request)
    {
        $data = ['values' => ['a', 'b', 'c']];

        $form = $this
           ->createFormBuilder($data)
           ->add('values', Type\CollectionType::class, [
               'entry_type'    => Type\TextType::class,
               'label'         => 'Add, move, remove values and press Submit.',
               'entry_options' => [
                   'label' => 'Value',
               ],
               'allow_add'    => true,
               'allow_delete' => true,
               'prototype'    => true,
               'required'     => false,
//                   'attr' => array (
//                           'class' => 'my-selector', <--- Not MVC compliant!
//                   ),
           ])
           ->add('submit', Type\SubmitType::class)
           ->getForm()
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $data = $form->getData();
        }

        return [
            'form' => $form->createView(),
            'data' => $data,
        ];
    }

    /**
     * Advanced usage
     *
     * A custom form theme helps define button's layout and positions as and where you want.
     *
     * @Route("/customFormTheme", name="customFormTheme")
     * @Template()
     */
    public function customFormThemeAction(Request $request)
    {
        $data = ['values' => [new Value('a'), new Value('b'), new Value('c')]];

        $form = $this
           ->createFormBuilder($data)
           ->add('values', Type\CollectionType::class, [
               'entry_type'   => ValueType::class,
               'label'        => 'Add, move, remove values and press Submit.',
               'allow_add'    => true,
               'allow_delete' => true,
               'prototype'    => true,
               'required'     => false,
               'attr'         => [
                   'class' => 'collection',
               ],
           ])
           ->add('submit', Type\SubmitType::class)
           ->getForm()
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $data = $form->getData();
        }

        return [
            'form' => $form->createView(),
            'data' => $data,
        ];
    }

    /**
     * Advanced usage
     *
     * Same demo as above, but with the add button located at the bottom of
     * the form instead of close to each field.
     *
     * @Route("/customFormThemeAddBottom", name="customFormThemeAddBottom")
     * @Template()
     */
    public function customFormThemeAddBottomAction(Request $request)
    {
        return $this->customFormThemeAction($request);
    }

    /**
     * Advanced usage
     *
     * Collection of collections are useful on the most dynamic forms, and a good
     * way to test if the plugin is working as expected too.
     *
     * @Route("/collectionOfCollections", name="collectionOfCollections")
     * @Template()
     */
    public function collectionOfCollectionsAction(Request $request)
    {
        $data = [
            'collections' => [
                [new Value('a'), new Value('b'), new Value('c')],
                [new Value('d'), new Value('e'), new Value('f')],
                [new Value('g'), new Value('h'), new Value('i')],
            ],
        ];

        $form = $this
           ->get('form.factory')
           ->createNamedBuilder('form', Type\FormType::class, $data)
           ->add('collections', Type\CollectionType::class, [
               'entry_type'    => Type\CollectionType::class,
               'label'         => 'Add, move, remove collections',
               'entry_options' => [
                   'entry_type'    => ValueType::class,
                   'label'         => 'Add, move, remove values',
                   'entry_options' => [
                       'label' => 'Value',
                   ],
                   'allow_add'      => true,
                   'allow_delete'   => true,
                   'prototype'      => true,
                   'prototype_name' => '__children_name__',
                   'attr'           => [
                       'class' => 'child-collection',
                   ],
               ],
               'allow_add'      => true,
               'allow_delete'   => true,
               'prototype'      => true,
               'prototype_name' => '__parent_name__',
               'attr'           => [
                   'class' => 'parent-collection',
               ],
           ])
           ->add('submit', Type\SubmitType::class)
           ->getForm()
        ;

        $form->handleRequest($request);
        if ($form->isValid()) {
            $data = $form->getData();
        }

        return [
            'form' => $form->createView(),
            'data' => $data,
        ];
    }

    /**
     * Advanced usage
     *
     * Looks like there are weird behaviours with Doctrine:
     * https://github.com/ninsuo/symfony-collection/issues/7
     * Let's test that live!
     *
     * ... hmm, doesn't look bad anyway
     *
     * @Route(
     *      "/usageWithDoctrine/{name}",
     *      name = "usageWithDoctrine",
     *      defaults = {
     *          "name" = "example"
     *      }
     * )
     * @Template()
     */
    public function usageWithDoctrineAction(Request $request, $name)
    {
        $repo = $this->getDoctrine()->getRepository('FuzAppBundle:MyArray');

        $data = $repo->findOneByName($name);
        if (is_null($data)) {
            $data = $repo->create($name);
        }

        $form = $this->createForm(MyArrayType::class, $data);
        $form->handleRequest($request);

        $form->get('save')->isClicked() && $form->isValid() && $repo->save($data);

        return [
            'names' => $repo->getArrayNames(),
            'form'  => $form->createView(),
            'data'  => $data,
        ];
    }

    /**
     * Related to usageWithDoctrine demo
     *
     * @Route(
     *      "/usageWithDoctrineDelete/{name}",
     *      name = "usageWithDoctrineDelete"
     * )
     */
    public function usageWithDoctrineDeleteAction(Request $request, $name)
    {
        $repo = $this->getDoctrine()->getRepository('FuzAppBundle:MyArray');
        if (!is_null($data = $repo->findOneByName($name))) {
            $repo->delete($data);
        }

        return $this->forward('FuzAppBundle:Advanced:usageWithDoctrine', [
            'name' => 'example',
        ]);
    }

    /**
     * A form having a theme and containing several fields
     *
     * @Route(
     *      "/formHavingSeveralFields",
     *      name = "formHavingSeveralFields"
     * )
     * @Template()
     */
    public function formHavingSeveralFieldsAction(Request $request)
    {
        $address = new Address();
        $address->setName('Mickael Steller');
        $address->setCompany('fuz.org');
        $address->setStreet('41 rue de la Paix');
        $address->setPostalcode('75002');
        $address->setCity('Paris');
        $address->setCountry('France');

        $addresses = new Addresses();
        $addresses->getAddresses()->add($address);

        $form = $this->createForm(AddressesType::class, $addresses);
        if ($request->isMethod('POST')) {
            $form->handleRequest($request);
        }

        return [
            'form' => $form->createView(),
            'data' => $addresses,
        ];
    }

    /**
     * Another example of form theme
     *
     * @Route(
     *      "/fancyFormTheme",
     *      name = "fancyFormTheme"
     * )
     * @Template()
     */
    public function fancyFormThemeAction(Request $request)
    {
        $fancyCollection = new FancyCollection();

        for ($i = 0; $i < 3; $i++) {
            $fancy = new Fancy();
            $fancyCollection->getFancyCollection()->add($fancy);
        }

        $form = $this->createForm(FancyCollectionType::class, $fancyCollection);

        $form->handleRequest($request);
        if ($form->isValid()) {
            $data = $form->getData();
        }

        return [
            'form' => $form->createView(),
            'data' => $fancyCollection,
        ];
    }
}
File: Controller/AdvancedController.php
File: Entity/MyArray.php
<?php

namespace Fuz\AppBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * MyArray
 *
 * @ORM\Table(
 *      name="my_array",
 *      uniqueConstraints={@ORM\UniqueConstraint(name="name_idx", columns={"name"})}
 * )
 * @ORM\Entity(repositoryClass="Fuz\AppBundle\Repository\MyArrayRepository")
 */
class MyArray
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    protected $name;

    /**
     * @var ArrayCollection
     *
     * @ORM\OneToMany(targetEntity="MyElement", mappedBy="array", cascade={"all"}, orphanRemoval=true)
     */
    protected $elements;

    public function __construct()
    {
        $this->elements = new ArrayCollection();
    }

    public function getId()
    {
        return $this->id;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    public function getElements()
    {
        return $this->elements;
    }
}
File: Entity/MyArray.php
File: Entity/MyElement.php
<?php

namespace Fuz\AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * MyElement
 *
 * @ORM\Table(name="my_element"),
 * @ORM\Entity
 */
class MyElement
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var MyArray
     *
     * @ORM\ManyToOne(targetEntity="MyArray", inversedBy="elements")
     * @ORM\JoinColumn(name="my_array_id", referencedColumnName="id")
     */
    protected $array;

    /**
     * @var string
     *
     * @ORM\Column(name="value", type="string", length=255)
     */
    protected $value;

    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    public function getId()
    {
        return $this->id;
    }

    public function setArray(MyArray $array)
    {
        $this->array = $array;

        return $this;
    }

    public function getArray()
    {
        return $this->array;
    }

    public function setValue($value)
    {
        $this->value = $value;

        return $this;
    }

    public function getValue()
    {
        return $this->value;
    }
}
File: Entity/MyElement.php
File: Form/MyArrayType.php
<?php

namespace Fuz\AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class MyArrayType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', TextType::class, [
                'label' => 'Array name:',
        ]);

        $builder->add('elements', CollectionType::class, [
            'label'        => 'Add an element...',
            'entry_type'   => MyElementType::class,
            'allow_add'    => true,
            'allow_delete' => true,
            'prototype'    => true,
            'required'     => false,
            'by_reference' => true,
            'delete_empty' => true,
            'attr'         => [
                'class' => 'doctrine-sample',
            ],
        ]);

        $builder->add('save', SubmitType::class, [
                'label' => 'Save this array',
        ]);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => 'Fuz\AppBundle\Entity\MyArray',
        ]);
    }

    public function getBlockPrefix()
    {
        return 'my_array';
    }
}
File: Form/MyArrayType.php
File: Form/MyElementType.php
<?php

namespace Fuz\AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class MyElementType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('value', TextType::class, [
            'required' => false,
        ]);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => 'Fuz\AppBundle\Entity\MyElement',
        ]);
    }

    public function getBlockPrefix()
    {
        return 'my_element';
    }
}
File: Form/MyElementType.php
File: Repository/MyArrayRepository.php
<?php

namespace Fuz\AppBundle\Repository;

use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\ORM\EntityRepository;
use Fuz\AppBundle\Entity\MyArray;

/**
 * MyArrayRepository.
 */
class MyArrayRepository extends EntityRepository
{
    public function create($name)
    {
        $data = new MyArray();
        $data->setName($name);
        try {
            $this->_em->persist($data);
            $this->_em->flush();
        } catch (UniqueConstraintViolationException $e) {
            return null;
        }

        return $data;
    }

    public function save(MyArray $data)
    {
        foreach ($data->getElements() as $element) {
            $element->setArray($data);
        }
        try {
            $this->_em->persist($data);
            $this->_em->flush();
        } catch (UniqueConstraintViolationException $e) {
            return null;
        }

        return $data;
    }

    public function getArrayNames()
    {
        $arrays = $this
            ->_em
            ->createQuery("
               SELECT arr.name
               FROM Fuz\AppBundle\Entity\MyArray arr
            ")
            ->execute();
        $names = [];
        foreach ($arrays as $array) {
            $names[] = $array['name'];
        }

        return $names;
    }

    public function delete(MyArray $data)
    {
        foreach ($data->getElements() as $element) {
            $this->_em->remove($element);
        }
        $this->_em->remove($data);
        $this->_em->flush();
    }
}
File: Repository/MyArrayRepository.php
File: Resources/views/Advanced/doctrine-theme.html.twig

{% block my_element_label %}{% endblock %}
{% block my_element_errors %}{% endblock %}

{% block my_element_widget %}

    <div class="row">
        <div class="col-md-7">
            {{ form_widget(form.value) }}
        </div>
        <div class="col-md-2">
            <a href="#" class="collection-up btn btn-default">Up</a>
            <a href="#" class="collection-down btn btn-default">Down</a>
        </div>
        <div class="col-md-2">
            <a href="#" class="collection-remove btn btn-default">Remove</a>
            <a href="#" class="collection-add btn btn-default">Add</a>
        </div>
        <div class="col-md-1">
            <a href="#" class="collection-duplicate btn btn-default">Duplicate</a>
        </div>
    </div>

{% endblock %}
File: Resources/views/Advanced/doctrine-theme.html.twig
File: Resources/views/Advanced/usageWithDoctrine.html.twig
{% extends 'FuzAppBundle::layout.html.twig' %}

{% block extra_js %}
    <script src="{{ asset('js/jquery.collection.js') }}"></script>
{% endblock %}

{% block title %}Advanced usage: example with Doctrine{% endblock %}

{% block body %}

    <h2>{{ block('title') }}</h2>

    <p>
        That's not really an <i>advanced</i> topic, but the sample will be a bit hard to read (as it takes many files),
        so let's say it targets more experienced Symfony users.
    </p>

    <p>
        In this demo, we're displaying a MyArray of MyElements, both persisted into the database. The MyArray entity
        only have an id and a name, and MyElement has id, MyArray's id and a value. This is quite the same as we seen
        in all demos, but persisted.
    </p>

    <div class="text-center">
        <input type="button" id="new" class="btn btn-default" value="Create new array"/>
    </div>

    {%
        form_theme form
            'jquery.collection.html.twig'
            'FuzAppBundle:Advanced:doctrine-theme.html.twig'
    %}
    {{ form(form) }}

    <hr/>

    {% if names|length %}
        Existing arrays:
        <table class="table">
            <thead>
                <th>Name</th>
                <th>Open</th>
                <th>Delete</th>
            </thead>
            <tbody>
                {% for name in names %}
                    <tr>
                        <td>{{ name }}</td>
                        <td>
                            {% if data.name != name %}<a href="{{ path('usageWithDoctrine', {'name': name}) }}">Open</a>{% endif %}
                        </td>
                        <td><a href="{{ path('usageWithDoctrineDelete', {'name': name}) }}">Delete</a></td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}

    {{
        tabs([
            'Base/BaseController.php',
            'Controller/AdvancedController.php',
            'Resources/views/Advanced/usageWithDoctrine.html.twig',
            'Resources/views/Advanced/doctrine-theme.html.twig',
            'Entity/MyArray.php',
            'Form/MyArrayType.php',
            'Entity/MyElement.php',
            'Form/MyElementType.php',
            'Repository/MyArrayRepository.php',
        ])
    }}

{% endblock %}

{% block script %}

    <script type="text/javascript">

        // only useful for the "new" button...
        $('#new').on('click', function() {
           var name = prompt("Which name would you like to use?");
           if (name) {
               var uri = '{{ path('usageWithDoctrine', {'name': 'a'}) }}';
               document.location = uri.substr(0, uri.length - 1) + encodeURIComponent(name);
           }
        });

        $('.doctrine-sample').collection();

    </script>

{% endblock %}
File: Resources/views/Advanced/usageWithDoctrine.html.twig