SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
4.
Všechny gettery, settery a obslužné metody jsou v jedné třídě </li></ul>$article = new Article(123); $article->setStatus(Article::STATUS_PUBLISHED); $article->setPublished(new DateTime); $article->save();
22.
Při find() načte data, vytvoří a naplní entitu, vrátí do repository
23.
Při save() dostane od repository entitu a uloží ji do daného uložiště </li></ul>$mapper = new ArticleDbMapper; $article = $mapper->find(123); $mapper->save($article);
28.
Na pozadí volá jednotlivé mappery </li></ul>$article = ArticleRepository::find(123); ArticleRepository::save($article); ArticleRepository::delete($article); ArticleRepository::move($article, 5);
29.
Repository <ul><li>Můžeme nahradit jednu repository za jinou, aniž bychom zasahovali do entity
31.
Jedna repository může podmíněně vracet různé typy entit: </li></ul>// vrátí Television (potomek Product) $product = ProductRepository::find(5); // vrátí Notebook (potomek Product) $product = ProductRepository::find(123);
35.
Omezení funkčnosti pro daného uživatele </li></ul>$post->publish(); <ul><li>Je to jen fasáda nad entitou: </li></ul>$article->setStatus(Article::STATUS_PUBLISHED); $article->setPublished(new DateTime); ArticleRepository::save($article);