Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Doctrine Lexer Use Case
Olivier Dolbeau
June 24, 2014
Programming
2
1k
Doctrine Lexer Use Case
PHPTour Lyon 2014 - 24/06/2014
Olivier Dolbeau
June 24, 2014
Tweet
Share
More Decks by Olivier Dolbeau
See All by Olivier Dolbeau
Jane & Webby
odolbeau
0
230
Translating a monolingual application
odolbeau
2
330
DX: Developer eXperience
odolbeau
0
43
DX: Developer eXperience
odolbeau
0
320
EasyAdminBundle introduction
odolbeau
0
100
REX API Platform
odolbeau
0
820
Features flags at BlaBlaCar
odolbeau
4
750
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
1
330
Be gentle with your prod!
odolbeau
1
480
Other Decks in Programming
See All in Programming
23年のJavaトレンドは?Quarkusで理解するコンテナネイティブJava
tatsuya1bm
1
140
domain層のモジュール化 / MoT TechTalk #15
mot_techtalk
0
150
AWSとCPUのムフフな関係
cmdemura
0
480
Why Money Forward contributes to Ruby and RubyKaigi?
luccafort
0
130
花き業界のサプライチェーンを繋げるプロダクト開発の進め方
userlike1
0
190
Qiita Night PHP 2023
fuwasegu
0
11k
PHPアプリケーションにおけるアーキテクチャメトリクスについて / Architecture Metrics in PHP Applications
isanasan
1
290
レガシーフレームワークからの移行
ug
0
130
OIDC仕様に準拠した Makuake ID連携基盤構築の裏側
ymtdzzz
0
600
2023年にクル(かもしれない)通信ミドルウェア技術(仮)
s_hosoai
0
220
Micro Frontends with Module Federation @MicroFrontend Summit 2023
manfredsteyer
PRO
0
640
Writing Greener Java Applications
hollycummins
0
360
Featured
See All Featured
Facilitating Awesome Meetings
lara
33
4.6k
Happy Clients
brianwarren
90
5.8k
Ruby is Unlike a Banana
tanoku
93
9.6k
Robots, Beer and Maslow
schacon
154
7.3k
Designing with Data
zakiwarfel
91
4.2k
GraphQLの誤解/rethinking-graphql
sonatard
39
7.8k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
224
50k
Embracing the Ebb and Flow
colly
75
3.6k
Unsuck your backbone
ammeep
659
56k
Building an army of robots
kneath
301
40k
Three Pipe Problems
jasonvnalue
89
8.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
32
6.7k
Transcript
Doctrine Lexer use case
None
Olivier Dolbeau @odolbeau Web Architect About me
RIDESHARING Cost of motoring 100€ 25€ 25€ 25€ 25€ @BlaBlaCar_FR
ALONE
A fast growing community
A European phenomenon
None
I want to be able to search tweets using a
human language.
None
None
None
None
Where are my tweets ?
None
None
None
None
None
None
Other solutions Logstash Home made external river
distributed restful search and analytics elasticsearch
None
None
None
None
None
We know what we want. We know where our data
is.
Now let’s see HOW we are doing to retrieve it.
How... … to translate a human language into a technical
one.
“ A retweet FROM @CameronNash23 ”
None
What’s a Lexer ? In computer science, lexical analysis is
the process of converting a sequence of characters into a sequence of tokens, i. e. meaningful character strings.
Tokens ! Now !
None
None
None
None
“ A retweet FROM @CameronNash23 ” T_SELECTOR T_RETWEET T_FROM T_USERNAME
How... … to use these tokens to generate an ElasticSearch
query.
None
None
None
None
It works!
None
None
None
And what about Doctrine ORM ? Let’s take a look
at : Doctrine\ORM\Query\Lexer
From DQL to SQL SELECT t0.id AS id1, t0.name AS
name3, t0. username AS username4, t0.email AS email5 FROM mos_users t0 WHERE t0.username = “foobar” SELECT u FROM MyProject\Model\User u WHERE u.username = ‘foobar’
77 tokens !!
Some patterns...
And a switch (true) !
Forget the Parser !
None
None
None
Example A trip OR A search FROM "Paris, France" OR
TO "Paris, France" BETWEEN 12/01/2013 AND 26/05/2014 A trip OR A search FROM "Paris, France" OR TO "Paris, France" BETWEEN 12/01/2013 AND 26/05/2014
Lexer to GET tokens. Parser to USE tokens.
@odolbeau On recrute ! :) MERCI !
@odolbeau https://joind.in/ 11246 https://github.com/odolbeau/elasticsearch-sandbox https://speakerdeck.com/odolbeau/doctrine-lexer-use-case