Information about doctrine - NFQ-Makers/api GitHub Wiki
In our project folder Model must have only Entities (E); One Entity represent one table row;
In our code need use EntityManager (EM), witch have one Connection to database, configured on config;
From EM we can get Repository (R) R = EM->getRepository("ENTITY_NAME_SPACE");
EntityManager#getRepository($entityName) returns a repository object which provides many ways to retrieve entities of the specified type. By default, the repository instance is of type Doctrine\ORM\EntityRepository;
Repository is used for find/get Entities from DB:
R->find($id);
R->findAll();
R->findBy(array('age' => 20));
R->findBy(array('age' => 20, 'surname' => 'Miller'));
R->findOneBy(array('nickname' => 'romanb'));
EM is used for write, update Entities to DB:
E = new Entity;
E->setName('Mr.Right');
EM->persist(E);
EM->flush();
More documentation on site: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/
Example on basic Reference between Entities (JOINS): http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html#entity-object-graph-traversal
This chapter explains mapping associations between objects: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html