From the course: Symfony 6 Essential Training
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Entities - Symfony Tutorial
From the course: Symfony 6 Essential Training
Entities
- [Instructor] Symfony provides everything you need to build a DB backed application. In most applications you'll be working with many similar items. In Laravel, they're called models. WordPress has some that are very specific: posts, terms, users, and in Symfony they're called entities. Jumping right into our terminal, let's tell the PHP interpreter to run bin/console with the arg make:entity. For this example, I'm going to keep it super simple and just create a post. There's a prompt to add properties. But before I do that, let's look at the file that was created. In source, Entity you can see our new post class and it has an integer property as ID. A post needs a title. And a title is a string, but let's look at the other options available by typing question mark. The main types are things you would expect, and then relationships are how entities interact with each other. There are also array/objects…