9. ORM?
Object-relational mapping is a programming
technique for converting data between
incompatible type systems in object-oriented
programming languages.
via https://en.wikipedia.org/wiki/Object-relational_mapping
13. Data Mapper
$user = new User('Pepa');
$em->persist($user);
$em->flush();
$user = $em->find(User::class, 1);
14. Data Mapper
- Můžu mít kompletně objektový model
- Entity jsou objekty, které se nestarají o persistenci
- To že je entita uložena v DB je “detail”
27. ElasticSearch
- obsahuje index
- indexy obsahují typy
- typy obsahují dokumenty
- dokumenty mají id a fieldy
GET /rohlikcz/product/123
28. ElasticSearch: (de)normalizace
- app -> databáze = normalizace
- méně dat
- méně duplikací
- horší na dotazování
- databáze -> ES = denormalizace
- duplikace, duplikace, duplikace
- so fucking fast
30. ElasticSearch + Doctrine
- Entity se nemapují 1:1 na typy
- Typy mají vlastní serializery
- V serializerech můžu pokládat SQL dotazy
- Synchronizace běží v RabbitMQ workeru
31. ElasticSearch + Doctrine
$product = $em->find(Product::class, 1);
$product->name = 'Banán';
$em->flush();
// volá se automaticky
$searchSync->append($product);
39. CQS
It states that every method should either be a
command that performs an action, or a query
that returns data to the caller, but not both.
In other words, Asking a question should not
change the answer.
via https://en.wikipedia.org/wiki/Command%E2%80%93query_separation
40. CQRS
Applies the CQS principle by using separate
Query and Command objects to retrieve and
modify data, respectively.
via https://en.wikipedia.org/wiki/Command%E2%80%93query_separation