Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

PHPMaster.com: Building a Domain Model – An Introduction to Persistence Agnosticism

PHPMaster.com: Building a Domain Model – An Introduction to Persistence Agnosticism

On PHPMaster.com there’s a recent tutorial introducing the concept of a “domain model” and showing how to create them in PHP (manually, not inside of any ORM or database solution).

First off, creating a rich Domain Model, where multiple domain objects with well-defined constraints and rules interact, can be a daunting task. Second, not only is it necessary to define from top to bottom the model itself, but it’s also necessary to implement from scratch or reuse a mapping layer in order to move data back and forward between the persistence layer and the model in question.

They include an example of a set of domain models tat relate to one another – a blog setup with posts, comments and users. They show how to create the AbstractEntity to handle a bit of the magic behind the scenes, an example “Post” and “Comment” models and how they can be put to work creating some posts and appending comments. A little bit of markup is included to output the results.

Source: http://www.phpdeveloper.org/news/17591

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Luty 28th, 2012 in WEB and PHP Development.

Leave a response: