Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Usnadněte si soužití s Doctrine
Search
Filip Procházka
October 27, 2013
Technology
37
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Usnadněte si soužití s Doctrine
Filip Procházka
October 27, 2013
More Decks by Filip Procházka
See All by Filip Procházka
Evolving architecture
fprochazka
0
260
Value objects in PHP
fprochazka
1
250
Jak psát testy na REST API
fprochazka
0
140
V gitu se nic neztratí
fprochazka
0
420
Co se PHP programátor může naučit od Javy?
fprochazka
1
160
4 roky remote
fprochazka
1
95
Před čím tě Nette ani Symfony neochrání
fprochazka
0
160
Nejlepší cache je žádná cache
fprochazka
0
140
Doctrine: co dělat, když entity nestačí
fprochazka
0
89
Other Decks in Technology
See All in Technology
購入ドメインでの課題と取り組み
ykagano
0
150
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
5
5.3k
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
5
2.2k
分析AIエージェントを育てる、動く環境を育てる
codatum
1
450
オンラインゲームのシステム全体像 - コロプラ 2026年度 新卒研修
colopl
0
970
[AWS 秋のクラウドオペレーション祭り 2026]AWS DevOps Agentで変わるリリースと運用対応 ~リリース管理機能と Directed actions のご紹介~
furuton
4
1.1k
生成AIを使って「人が」考える技術 ― AI時代の人機共想と実践ノウハウ|UNITT AC2026
ishiirikie
0
570
全PRの83%が AIレビューだけでマージできるようになった開発組織は その後どうなったか @2026/10
athug
0
130
AI Made Us Faster at Solving the Wrong Problems
marceloancelmo
0
190
AIに攻撃される前に、AIに攻撃させる
tsuchikazu
0
160
並行性の問題を防げ!実践トランザクション入門
occhi
0
280
FactoryBotアンチパターン / factory_bot anti-patterns
toshimaru
0
140
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
580
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
470
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
970
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
260
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Docker and Python
trallard
47
4.2k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
790
Transcript
Usnadněte si soužití s Doctrine Filip Procházka
Co si ukážeme? + Kdyby/Doctrine + Kdyby/Console + Kdyby/Events
Proč Kdyby? - Doctrine má spoustu skvělých vlastností - Doctrine
má spoustu otravných vlastností - Kdyby je plug&play (convention over configuration), tedy konfigurace na pár řádků a hned můžete pracovat
Instalace $ composer require \ kdyby/doctrine $ composer create-project \
hosiplan/project
Konfigurace extensions: annotations: Kdyby\Annotations\DI\AnnotationsExtension console: Kdyby\Console\DI\ConsoleExtension events: Kdyby\Events\DI\EventsExtension doctrine: Kdyby\Doctrine\DI\OrmExtension
Konfigurace doctrine: user: foo password: bar dbname: sandbox metadata: App:
%appDir%
Entita use Doctrine\ORM\Mapping as ORM; /** @ORM\Entity() */ class Article
extends \Kdyby\Doctrine\Entities\IdentifiedEntity { /** @ORM\Column(type="string") */ protected $title; }
BaseEntity? Ta je přece fuj! class Article extends BaseEntity {
private $one; protected $two; public $three; }
Skvělé na prototypování $article->getOne(); $article->one; $article->getTwo(); $article->two; $article->getThree(); $article->three; $article->addComment($comment);
$article->removeComment($comment);
Striktní validace schématu $ php www/index.php \ orm:validate
Entity potřebují tabulky... $ php www/index.php \ orm:schema:up --dump-sql
Proxy třídy kvůli lazy loadingu $ php www/index.php \ orm:generate:proxies
Repository DAO $articles = $entityManager ->getDao(App\Article::getClassName()); $articles = $entityManager ->getDao(App\Article::class);
Ne, repository nestačí... $article = new Article(); $article->title = "The
Tigger Movie"; $articles->save($article); $article = $articles->find(1); echo $article->title; // "The Tigger Movie"
Repozitář umí hezky nabobtnat class ArticlesDao extends EntityDao { function
findByTitle($title); function findByStepmothersBrothersEyeColor(); function findBy...(); }
Hlavně žádné další dědění! class ArticlesDao extends EntityDao { function
findByTitle($title); function findByStepmothersBrothersEyeColor(); function findBy...(); }
Krocení repozitářů http://www.whitewashing.de http://www.whitewashing.de/2013/03/04/doctrine_repositories.html http://filip-prochazka.com/blog/doctrine-a-service-vrstva-aneb-takto-mi-to-dava-smysl
Tak třeba objednávky... OrderModel - Order\UserOpening - Order\Dispatching - Order\Delivery
- ….
Eventy: systémové listenery class EditLogger implements Kdyby\Events\Subscriber { function getSubscribedEvents()
{ return array('postUpdate'); } function postUpdate() { } }
Eventy: systémové listenery services: something: class: App\EditLogger tags: [kdyby.subscriber]
ResultSet $dql = $articles->createQuery("SELECT a FROM Articles a"); $articles =
new Kdyby\Doctrine\ResultSet($dql); $articles->applyPaginator($this['vp']->paginator);
Utilitky Helpers::loadFromFile() Tools\NonLockingUniqueInserter
Dotazy?
Filip Procházka http://filip-prochazka.com http://www.kdyby.org