Exercise Wednesday

Goal: The goal for today is to practice creating many to many relationships with your applications and to reflect that relationship in your Silex application.

Code


Library

Let's move on to a new program to catalog a library's books and let patrons check them out. Here are some user stories for you:

  • As a librarian, I want to create, read, update, delete, and list books in the catalog, so that we can keep track of our inventory.
  • As a librarian, I want to search for a book by author or title, so that I can find a book when there are a lot of books in the library.
  • As a librarian, I want to enter multiple authors for a book, so that I can include accurate information in my catalog. (Hint: make an authors table and a books table with a many-to-many relationship.)
  • As a patron, I want to check a book out, so that I can take it home with me.
  • As a patron, I want to know how many copies of a book are on the shelf, so that I can see if any are available. (Hint: make a copies table; a book should have many copies.)
  • As a patron, I want to see a history of all the books I checked out, so that I can look up the name of that awesome sci-fi novel I read three years ago. (Hint: make a checkouts table that is a join table between patrons and copies.)
  • As a patron, I want to know when a book I checked out is due, so that I know when to return it.
  • As a librarian, I want to see a list of overdue books, so that I can call up the patron who checked them out and tell them to bring them back - OR ELSE!