Well, entity is a type of object that is used to hold data. Each instance of entity holds exactly one row of targeted database table.
As for the directories,
Symfony2 has some expectations where to find classes - that goes for entities as well. Symfony2 enforces entity syntax
Bundle:EntityName, so when you say fetch me all the data from "AcmeTaskBundle:SomeEntity" it knows to look for class file at
You should probably watch some tutorials on
ORM first (Symfony2 uses
Doctrine ORM by default), or skip data persisting altogether for now...
An entity is an object that represent the underlying data (as @perovic said: exactly one line of data from a single table, joined with data from other tables).
From Wikipedia's "Entity" definition:
A DBMS entity is either a thing in the modeled world or a drawing element in an ERD.
(The full concept of computer engineering entity is defined in Wikipedia's "Entity–relationship model" definition)
In Symfony's Documentation "The Book", chapter "Databases and Doctrine", the "product" object is the entity. It's relationship with the RDB is described under the title "Add Mapping Information".
In Symfony, the entire model (the data tier) is persisted (saved, updated) and managed through Doctrine.
This is just the main concept. More information can be found here:
- Doctrine 2 ORM’s documentation
- Databases and Doctrine chapter at The Book
- Googeling "what is a data entity"
(WOW. writing all that with 2 links and no images was TOUGH :P )
The entity object is an abstraction for you to interact with database. For example, instead of doing
UPDATE Book SET title="My Book" WHERE isbn="123456789";
You can simply access the object
/** @var $book \Acme\TaskBundle\Entity\Book **/ $book = $repository->findOneByIsbn('123456789'); $book->setTitle('My Book'); /** @var $em \Doctrine\ORM\EntityManager **/ $em->persist($book) $em->flush();
There is a lot running behind. For more information, please consult Doctrine ORM documentation.
The Acme\TaskBundle\Entity path is the default location for Doctrine to load Entity definition.
- What is entity manager in symfony 2 and how it works internally?
- What am I missing - Symfony 3 Doctrine Entity ManyToMany?
- What is the best way to create a singleton entity in Symfony 4?
- What is the correct way to extend an existing entity in a Symfony bundle
- What is the new Symfony 3 directory structure?
- What is a "weak route" in Symfony 2?
- What does ~ mean in the YML configuration file in Symfony 2?
- What is the Symfony firewall doing that takes so long?
- Add a column to an existing entity in Symfony
- How to use my Entities and Entity Managers in Symfony 2 Console Command?
- Symfony 2.0 getting service inside entity
- Symfony Flex: What does symfony.lock file do?
- Symfony 2 : Add a custom form element, not in an Entity
- How to set up entity (doctrine) for database view in Symfony 2
- How to get entity manager for Doctrine entity with Symfony 2.1 from inside controller
- Generating Entity Getters and Setters in Symfony / Doctrine ORM
- What is causing a "Maximum function nesting level" error in Symfony 2.1 and Twig?
- Symfony form - Access Entity inside child entry Type in a CollectionType
- symfony : can't we have a hidden entity field?
- Nullable custom form entity with Symfony
- What is the difference between Entity and Model in Symfony2 / Doctrine
- Eager loading of related entity in Symfony 2
- Symfony : What is the meaning of auto_mapping and auto_generate_proxy_classes
- What are symfony bridges, bundles and vendor?
- Symfony 2 Create a entity form field with 2 properties
- Deserialize an entity with a relationship with Symfony Serializer Component
- Symfony form query_buider and entity repository
- Symfony 2 - Entity has to be managed or scheduled for removal for single computation
- What is the difference between a bundle, component and a service in Symfony Framework?
- What is the correct way to add bootstrap to a symfony app?
More Query from same tag
- Create new content using Sonata Admin when mapped entity is an abstract class
- Symfony2 One-to-many edit action
- How to Install Swagger on Symfony 4?
- Render Symfony 5 service as twig global
- path to a page in another bundle
- How to know who called an action of controller in symfony
- Include a controller to get parameter in Twig
- Symfony2, How to set attribute class depending on value?
- How do I check for the existence of a bundle in twig?
- How to write multiple entity classes that share functions in Symfony2
- Unable to find the controller for path "/api/login_check". The route is wrongly configured
- Symfony 3 - in prod, assetic works fine with "AppKernel('prod', true)", not with "AppKernel('prod', false)"
- How to unit test entity assert in Symfony form?
- Using repository class methods inside twig
- Twig : how to check if there's a request ? (looking for symfony 5 : app.request)
- Doctrine Entity won't serialize with JMS Serializer
- How do you configure a binary environment variable with Symfony YAML configuration?
- elasticsearch - where fields is null
- htaccess: Using silex/symfony and web-directory redirect
- Symfony2 custom connection by web service
- Symfony project CMS
- Symfony2 - Tests with FOSUserBundle
- UniqueEntity validation error placed on password field in FOSUserBundle
- concatenate result from getRepository symfony
- ddeboer/data-import Error: Cannot instantiate interface Ddeboer\DataImport\Workflow
- How to add extra bag to symfony session
- ManyToOne join in symfony2
- Will Symfony2 Security Component Work With A Multi-Domained System?
- symfony2 asks for intl extension and its already installed
- Changing priority of a subscriber coming from a vendor's bundle