Latest news and articles about DDD, CQRS, Event Sourcing and Software Architecture in general, aggregated daily and delivered weekly to your feed (RSS) reader. Subscribe here!

Week 20, year 2011

  • Lazy Loading in PHP with Closures - Closures are a great way to do all kinds of neat tricks in PHP, and they’re particularly useful for Lazy Loading. I’m currently involved in a +200k SLoC legacy project, and the challenge is moving it to a Domain Driven implementation (while improving the performance), with the ultimate goal of making it more testable. The problem We want to find a Customer, and ask it for a list of Orders: <?php// client code$customer=$customerRepository->find($id);$orders=$customer->getOrders(); With the ActiveRecord pattern, this is simple. The Customer object holds an instance of the database adapter, and queries it for related Orders: <?phpclassCustomer{publicfunctiongetOrders(){$ordersData=$this->db->query(/* select orders. . . [Mathias Verraes]
Permalink | From 16 May 2011 to 22 May 2011 | Last updated on: Mon, 7 Jun 2021 09:18:52 GMT