phpcr-odm icon indicating copy to clipboard operation
phpcr-odm copied to clipboard

Add generate documents command

Open wouterj opened this issue 11 years ago • 8 comments

Both the ORM and MongoDB ODM have a command which creates getters and setters, based on the mapping data. The PHPCR ODM should also provide something this command.

I'm in doubt what the command name should be. The ORM uses orm:generate:entities and the MongoDB ODM uses odm:generate:documents. Some suggestions:

  • odm:generate:documents (duplicate, but it's the most logical)
  • phpcr:generate:documents (simple and descriptive, but sounds like it's something from phpcr/phpcr and not doctrine/phpcr-odm)
  • phpcr-odm:generate:documents (best option, but a very long command)

For the last 2 suggestions, I would prefer to rename the MongoDB ODM command too.

I'll start working on this one, but I would like to discuss the best name.

wouterj avatar Oct 17 '13 10:10 wouterj

I think doctrine:phpcr:generate:documents would be most consistent with what we already have.

dantleech avatar Oct 17 '13 11:10 dantleech

I see, but that means all commands for phpcr odm are inconsistent with other doctrine projects.

wouterj avatar Oct 17 '13 14:10 wouterj

ORM:

$ php app/console doctrine:generate:entities AcmeBlogBundle

MongoDB:

$ php app/console doctrine:mongodb:generate:documents AcmeStoreBundle

PhpcrOdm

$ php app/console doctrine:phpcr:generate documents AcmeStoreBundle

The latter two are the "bundled" commands, i.e. they wrap odm:generate:documents and I guess what would be phpcr:generate:documents in the PHPCR\Commands.

dantleech avatar Oct 17 '13 15:10 dantleech

hmm ignore what I said about wrapping a PHPCR command - that makes no sense at all :)

dantleech avatar Oct 17 '13 15:10 dantleech

@dantleech, all commands you show are the commands of the bundles (DoctrineBundle and DoctrineMongoDbBundle). Those bundles extend a command that is defined in their library (resp. orm and mongodb odm). In this issue, I'm not talking about the command names for the DoctrinePHPCRBundle, but about the command names of the phpcr-odm library (so the command you use when using phpcr odm standalone).

wouterj avatar Oct 17 '13 16:10 wouterj

Hmm. A dilema. phpcr:generate:documents would indeedbe wrong. @dbu

Wouter J [email protected] wrote:

@dantleech, all commands you show are the commands of the bundles (DoctrineBundle and DoctrineMongoDbBundle). Those bundles extend a base command, which is defined in their library (resp. orm and mongodb odm). In this issue, I'm not talking about the command names for the DoctrinePHPCRBundle, but about the command names of the phpcr-odm library.


Reply to this email directly or view it on GitHub: https://github.com/doctrine/phpcr-odm/issues/361#issuecomment-26522487

Sent from my Android device with K-9 Mail. Please excuse my brevity.

dantleech avatar Oct 17 '13 18:10 dantleech

I think the so far we called all phpcr-odm specific commands doctrine:phpcr:... Which seems inconsistent with the rest of doctrine, but has the benefit of being consistent with the symfony bundle command names. Which imho is what counts more, as people will read library documentation and symfony cmf documentation. so i would be all for doctrine:phpcr:...

dbu avatar Oct 18 '13 06:10 dbu

in #415 i add the helper to filter (for the proxy generation command). this is used by the orm to filter what documents should be generated.

to actually do this, we could either copy the generator from orm (and mongo and whatever), or we can check if there is potential for a common generator abstraction and see if we can move that to commons - the interest for that seems not that big: https://twitter.com/dbu/statuses/431716020915429376

dbu avatar Feb 07 '14 18:02 dbu