1

I successed to integrate Doctrine 2 and Zend Framework using a Doctrine2 Application Resource and it works great, cli and web, but I couldn't find any informations on how structure my models.

Right now, here is my workflow:

  1. I write my entities in models/Entities using Annotation Driver
  2. I generate entities with php bin/doctrine orm:schema-tools:create This part overrides my Entities with public setters and getters

But I'm struggling here.

I'm not sure on how Entities should be used.

should it looks like this :

application/
- models/
-- Entities/
--- Product.php
--- Category.php
-- Proxies/
--- Product.php
--- Category.php
-- Repositories/
--- Product.php
--- Category.php

Is it correct or Am I totally wrong?

By the way, when are used both Proxies & Repositories ? I can't find relevant documentation about them.

If you know where I can find an actual Doctrine 2 project, or better an actual Zend Framework + Doctrine 2 Project it'll be great.

Thanks for your help.

ÉricP
  • 272
  • 1
  • 7

1 Answers1

0

Doctrine 2 generated your Domain Objects and Repositories, it is not your Domain Model. You can perfectly create your Entities in library folder and them implement your Model classes inside models directory of your ZF application.

Usually Models contain DO's validation, since DO's are extremely simple and should not contain complex logic. Repositories hold the data manipulation, but it should not include business logic.

Cheers,

Guilherme Blanco
  • 1,234
  • 8
  • 8