modules.zendframework.com icon indicating copy to clipboard operation
modules.zendframework.com copied to clipboard

[WIP] Feature/doctrine

Open ins0 opened this issue 8 years ago • 10 comments

This PR is adding Doctrine ORM to the Project and will replace the Zend\Db Mappers. Follows after Discussion in #496

  • [x] added doctrine
  • [x] added module entity
  • [ ] added user entity
  • [x] changed application module
  • [ ] changed user module
  • [ ] changed zfmodule module
  • [ ] remove old mapper
  • [ ] edit existing tests

@localheinz @gianarb @Ocramius @GeeH

ins0 avatar Sep 19 '15 00:09 ins0

@ins0

What do you think, can I help with a PR that prepares for this and adds the capability to run Doctrine migrations?

localheinz avatar Sep 23 '15 07:09 localheinz

@localheinz

What do you think, can I help with a PR that prepares for this and adds the capability to run Doctrine migrations?

Yes please! I'm not very familiar with Doctrine Migrations nor how to setup this feature

ins0 avatar Sep 23 '15 07:09 ins0

@ins0

Doctrine migrations are implemented in #502.

About this PR, what do you think about breaking it up into smaller parts? Since we agreed that we want to use Doctrine, it doesn't need to be implemented all in one PR.

Maybe start with creating entities and making sure we've got the schema right? Then, in a next step, start using them.

We should be running

$ php public/index.php orm:info
$ php public/index.php orm:validate-schema

as part of the script on Travis, and just make sure for a start that the mappings are right.

What do you think?

localheinz avatar Sep 26 '15 16:09 localheinz

@localheinz sound good to me. what do u suggest, changing the current db structure - creating doctrine entitys or vice versa?

This is the first time i meet doctrine migrations (oh boy - don't let @Ocramius hear that :smile_cat: ) so currently i don't know for sure what had changed, if someone can give me a short hint with this that would be nice.

/cc @gianarb

ins0 avatar Oct 19 '15 06:10 ins0

IMO we can use doctrine\migrations to change the current database schema. After this process we can write a correct entities.. :)

A migration is very easy to implement. http://docs.doctrine-project.org/projects/doctrine-migrations/en/latest/reference/migration_classes.html.

We can write a SQL script to update our struct.. And another SQL script to down it in the old version

gianarb avatar Oct 19 '15 07:10 gianarb

@ins0

Depends entirely on which way you want to go - do you have a preference?

By the way, zendframework/modules.zendframework.com:1.6.0 has been deployed - with a little downtime, as I forgot to edit the local configuration files before deploying, but, it's up!

localheinz avatar Oct 19 '15 08:10 localheinz

@ins0

Following the merge of #502, you need to rebase, sorry!

localheinz avatar Oct 19 '15 08:10 localheinz

@ins0

In regard to the migrations, as @gianarb suggested, you can start by creating migrations as suggested:

$ php public/index.php migrations:generate

This will create a migration class, which you can modify to your needs.

If you have a migration which you can't or don't ever want to be able to roll back, you should probably throw a Doctrine\DBAL\Migrations\IrreversibleMigrationException.

localheinz avatar Oct 19 '15 09:10 localheinz

thanks @gianarb @localheinz , so i think i will stop here and handle the remaining todos (described above) in different prs as this is more clear, do u agree? the proposed db change #496 don't affect this improvement nor needs db changes so i think migration changes will not occur in this and the following prs

ins0 avatar Oct 19 '15 09:10 ins0

Yes.. It sounds good :)

More easy to merge and to follow :)

2015-10-19 11:11 GMT+02:00 Marco Rieger [email protected]:

thanks @gianarb https://github.com/gianarb @localheinz https://github.com/localheinz , so i think i will stop here and handle the remaining todos (described above) in different prs as this is more clear, do u agree?

— Reply to this email directly or view it on GitHub https://github.com/zendframework/modules.zendframework.com/pull/497#issuecomment-149153460 .

Gianluca Arbezzano www.gianarb.it

gianarb avatar Oct 19 '15 09:10 gianarb