Entities only display the database table when they are configured for this, from the book she reads:
A class — often referred to as an “entity,” meaning a base class that contains data — is simple and helps you meet the business requirements associated with the needs of the products in your application. http://symfony.com/doc/current/book/doctrine.html#creating-an-entity-class
It’s good practice to model your data in a more formal way than using simple arrays, which is why they exist.
Perhaps they are most often used to map data to a database, but this is not a requirement. They perform the task of creating data containers that model the information in your application in a way that makes sense. (i.e. model USER in USERS)
If you do not use the database to save your objects, you can use them to transfer data, create forms, use the verification service, security, etc. It might also be a good idea to create a service that allows you to access information about your web services from your Symfony application so that you can have something like:
$user = $this->get('some_persistance_service_you_write')->find($id,'user'); $user->setName('new value'); $err = $this->get('validator')->validate($user);
This, of course, is off topic, but it is an example of how you can use objects without access to the database.
Xocoatzin
source share