The general talk was about using extensions for symfony2 and doctrine2 to increase productivity and simplify daily tasks. These slides mainly introduce the best features of extensions.
1. WHO'S TALKING?
Gediminas Morkevičius aka @l3pp4rd
I code with - PHP, Go, JavaScript, C
I'm an open-source geek - ViM, Arch Linux, DWM user
And I share my stuff github.com/l3pp4rd
3. SOME HISTORY
The initial commit 2010-09-03 MIT licensed
Maintained ever since
Purpose - provide common model behaviors
Derive metadata mapping and caching technics
Be a framework independent library
4. AN EXAMPLE
<pp
?h
nmsaeEtt;
aepc niy
ueGdoMpigAntto a Gdo
s emapnnoain s em;
ueDcrnRapn a OM
s otieOMMpig s R;
/*
*
*@Rniy
OMEtt
*@emoteeebefedae"eeeA"
GdoSfDltal(ilNm=dltdt)
*
/
casPout
ls rdc
{
/*
*
*@emrnltbe
GdoTasaal
*@Rounlnt=4
OMClm(egh6)
*
/
piae$il;
rvt tte
/*
*
*@emlgfed="il",udtbefle
GdoSu(ils{tte} paal=as)
*@Rounlnt=4 uiu=re
OMClm(egh6, nqetu)
*
/
piae$lg
rvt su;
/*
*
*@emietmal(n"rae)
GdoTmsapbeo=cet"
*@Rountp=dttm"
OMClm(ye"aeie)
*
/
piae$raeA;
rvt cetdt
/*
*
11. SORTABLE
Tracks sorting position on your entity
/*
*
*@emotbeoiin
GdoSralPsto
*@Rountp=itgr)
OMClm(ye"nee"
*
/
piae$oiin
rvt psto;
/*
*
*@emotberu
GdoSralGop
*@Rayon(agtniy"aeoy)
OMMnTOetreEtt=Ctgr"
*
/
piae$aeoy
rvt ctgr;
12. SOFTDELETEABLE
Softly removes your entities, so they get filtered out
afterwards, but maintain in the database.
/*
*
*@emoteeebefedae"eeeA"
GdoSfDltal(ilNm=dltdt)
*@Rniy
OMEtt
*
/
casPout
ls rdc
{
/*
*
*@Rounlnt=4
OMClm(egh6)
*
/
piae$il;
rvt tte
/*
*
*@Rountp=dttm" nlal=re
OMClm(ye"aeie, ulbetu)
*
/
piae$eeeA;
rvt dltdt
}
/..
/.
13. Given the actions are performed:
$0=nwEttrdc;
p
e niyPout
$0>eTte'ilb sfdltd)
p-stil(Wl e oteee';
$1=nwEttrdc;
p
e niyPout
$1>eTte'rlyscesu pout)
p-stil(Tul ucsfl rdc';
$m>ess(p)
e-prit$0;
$m>ess(p)
e-prit$1;
$m>ls(;
e-fuh)
/ a sm pit pouti rmvd
/ t oe on, rdc s eoe
$m>eoe$0;
e-rmv(p)
$m>ls(;
e-fuh)
eh cut$m>eRpstr(Ettrdc'-fnAl);
co on(e-gteoioy'niyPout)>idl()
/ rsl i:1
/ eut s
14. NESTED-SET TREE
Manages your entity as Nested-Set strategy based tree.
<pp
?h
nmsaeEtt;
aepc niy
ueGdoMpigAntto a Gdo
s emapnnoain s em;
ueDcrnRapn a OM
s otieOMMpig s R;
/*
*
*@emretp=nse"
GdoTe(ye"etd)
*@RniyrpstrCas"emreEtteoioyNseTeRpstr"
OMEtt(eoioyls=GdoTeniyRpstretdreeoioy)
*
/
casCtgr
ls aeoy
{
/*
*
*@Rountp=itgr)
OMClm(ye"nee"
*@Rd
OMI
*@ReeaeVle
OMGnrtdau
*
/
piae$d
rvt i;
/*
*
*@Rounlnt=4
OMClm(egh6)
*
/
piae$il;
rvt tte
/*
*
*@emreet
GdoTeLf
*@Rountp=itgr)
OMClm(ye"nee"
*
/
16. How to keep your tree records secure from getting
compromised during concurrent requests?
Given we have entities:
/*
*
*@Rniy
OMEtt
*
/
casOgnsto {*.*}
ls raiain /../
/*
*
*@emretp=nse"
GdoTe(ye"etd)
*@RniyrpstrCas"emreEtteoioyNseTeRpstr"
OMEtt(eoioyls=GdoTeniyRpstretdreeoioy)
*
/
casPoet
ls rjc
{
/*
*
*@Rayon(agtniy"raiain)
OMMnTOetreEtt=Ognsto"
*@RonounrfrneClmNm=i" nlal=as)
OMJiClm(eeecdounae"d, ulbefle
*
/
piae$raiain
rvt ognsto;
}
/../
*.*
17. On every request when you move, insert Project you have a
hard relation Organisation. Meaning, you have to select the
specific organisation in order to update the tree.
ueDcrnBLLcMd;
s otieDAokoe
$on=$m>eCneto(;
cn
e-gtoncin)
/ sattascin
/ tr rnato
$on>eiTascin)
cn-bgnrnato(;
ty{
r
/ slcsognsto frudt -lcsi fray
/ eet raiain o pae
ok t o n
/ ra/rt atmt utlti tascined
/ edwie teps ni hs rnato ns
$r =$m>id"niyOgnsto" $rI,LcMd:PSIITCWIE;
og
e-fn(Ettraiain, ogd okoe:ESMSI_RT)
/ cet anwctgr
/ rae
e aeoy
$uPoet=nwPoet
sbrjc
e rjc;
$uPoet>eTte$PS[tte];
sbrjc-stil(_OT"il")
$uPoet>eOgnsto(og;
sbrjc-straiain$r)
$aetrjc =$m>id"niyPoet,$PS[prn_d];
prnPoet
e-fn(Ettrjc" _OT"aeti")
/ pritadfuh
/ ess n ls
$m>eRpstr(Ettrjc"
e-gteoioy"niyPoet)
-pritsisCidf$uPoet $aetrjc)
>essAFrthlO(sbrjc, prnPoet;
$m>ls(;
e-fuh)
$on>omt)
cn-cmi(;
}cth(Ecpin$){
ac xeto e
$on>olak)
cn-rlbc(;
trw$;
ho e
}
18. Read more about available locking mechanisms supported
by database you are using, some references:
Transactions and concurrency on Doctrine2 website
Locking reads on MySQL 5.5 manual page
Any actions which does atomic operations needs to be
secured including Sortable extension.
19. FUTURE PLANS:
1.
2.
3.
4.
5.
6.
One next big version upgrade expected 2014
Simplify integration without any preconfiguration using
sensible defaults.
Improve extensions based on the issues learned.
Make them less feature rich, but more customizable.
Improve documentation, add helper commands to review
active listeners and watched entities.
Maintain compatibility without changes to public
interface.
Progress can be followed on pull request