Labs
-
Create a bi-directional, many-to-one relationship between Rental and InventoryItem.
-
Update the test cases for InventoryItem and Rental to ensure the associations are working correctly.
-
Create a Payment entity mapped to the
paymenttable with propertiesid,amount, andpaymentDate. Thepaymenttable looks like this:
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| rental_id | int(11) | YES | MUL | NULL | |
| amount | decimal(5,2) | NO | | NULL | |
| payment_date | datetime | NO | | NULL | |
+--------------+------------------+------+-----+---------+----------------+
-
Create a bi-directional, many-to-one relationship from Payment to Rental. Update the unit tests for both entities to validate each side of the relationship.
-
In Rental, create addPayment and removePayment methods.