Join Jon Peck for an in-depth discussion in this video Establishing associations between entities, part of Up and Running with Symfony2 for PHP (2014).
- [Voiceover] Doctrine supports many kinds…of Association Mapping…for it to finding relationships between entities.…There are three main kinds of associations.…The first is one to one,…where each row is linked to one, and only one row.…The next kind, one to many, is very common…where each row can be related…with many rows in another table.…We're going to be using a one to many association…with publication as the one parent…and issue as the many children.…Finally, Doctrine supports many to many associations…where one or more rows can be related to zero,…one, or more rows in another table.…
Within these associations,…there are variants…like supporting a joining table and so forth.…Actually describing these associations between entities…takes a number of steps…so I'm going to describe them in detail.…Then we'll do it together.…In the parent, three major steps are required.…First, we'll need to add a property to the entity…to store the child's associations.…It's best practice to give the property a plural name…based on the child.…
- Installing Symfony
- Creating a bundle from the console
- Customizing and generating database tables
- Generating controllers
- Creating, editing, and debugging entities
- Displaying and debugging a form
- Rendering content with templates
Skill Level Intermediate
Q: When trying to access the application, I receive an error stating "This script is only accessible from localhost." How can I get around this restriction?
A: The development front controller and configuration scripts are protected by default to only allow access from the localhost. Refer to the video titled “Exploring the Symfony layout” to see how to disable this security.