6
Models and Object-Relational Mappers with Behavior-Driven Development
In this chapter, we will use laminas-db
to map an entity-relationship model to an object model. Instead of just implementing mappers with Laminas, we will also create a most powerful reusable mapper extending Laminas classes. Finally, we will show how models and mappers are connected. Along with the creation of the classes, we will use the approach of behavior-driven development (BDD) to keep user-readable requirements in our source code.
By the end of this chapter, you will have learned how to create models and object-relational mapper classes using the approach of BDD. You will know how to map system requirements to code in a well-organized way. I hope you finish the chapter feeling as satisfied as Luke Skywalker did after exploding the Death Star!
In this chapter, we’ll be covering the following topics:
- BDD with Behat
- Creating models from user stories
- Creating mappers from...