Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Review basic mapping #2668

Merged
merged 1 commit into from
Jul 3, 2024
Merged

doc: Review basic mapping #2668

merged 1 commit into from
Jul 3, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jul 3, 2024

Q A
Type doc
BC Break no
Fixed issues -

@@ -20,7 +20,7 @@ Change the metadata driver configuration to use the ``AttributeDriver``:
- $config->setMetadataDriverImpl(AnnotationsDriver::create(__DIR__ . '/Documents'));
+ $config->setMetadataDriverImpl(AttributeDriver::create(__DIR__ . '/Documents'));

Replace the `@ORM\Document` annotations with the `#[ORM\Document]` attribute.
Replace the ``@ORM\Document`` annotations with the ``#[ORM\Document]`` attribute.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double backticks are required in rst for code.

Comment on lines +14 to +15
- `Attributes <annotations-reference>`_
- `XML <xml-mapping>`_
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find is useful to have links to more details.

Comment on lines -26 to -29
the day all drivers perform equally well. If you're not using a
metadata cache (not recommended!) then the XML driver might have a
slight edge in performance due to the powerful native XML support
in PHP.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using attributes may be faster than XML now. Is was not the case for annotations. Unless we do a benchmark, this is only hypothesis. So I remove this sentence from the doc.

@@ -61,6 +57,8 @@ to be designated as a document. This can be done through the

namespace Documents;

use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page is for newcomers. Having the use statements is useful.

#[Document]
class MyPersistentClass
{
#[Id(strategy: 'NONE', type: 'string')]
private string $id;

public function setId(string $id): void
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the setter with a public property.

.. note::

If you do not want to use latest XML Schema document please use link like
`http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping-1.0.0-BETA12.xsd <http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping-1.0.0-BETA12.xsd>`_.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GromNaN GromNaN merged commit 620120e into doctrine:2.9.x Jul 3, 2024
17 of 18 checks passed
alcaeus added a commit that referenced this pull request Sep 6, 2024
* 2.9.x: (24 commits)
  Fix typo in code example (#2670)
  Label PRs about GH actions with "CI" (#2632)
  Review basic mapping (#2668)
  Fix wording (#2667)
  Add native type to private properties and final classes (#2666)
  Review and add tests on `ResolveTargetDocumentListener` (#2660)
  Remove soft-delete-cookbook (#2657)
  doc: Remove wakeup and clone cookbook (#2663)
  Modernize generated code for Hydrators (#2665)
  Add tests for introduction (#2664)
  doc: Review mapping ORM and ODM cookbook (#2658)
  doc: Review cookbook on blending ORM and ODM (#2656)
  doc: Review and test validation cookbook (#2662)
  Update custom mapping example (#2654)
  doc: Review Simple Search Engine Cookbook (#2659)
  doc: Add cookbook about embedding referenced documents using $lookup (#2655)
  doc: Add type to properties (#2652)
  doc: Review custom collections and repository docs (#2653)
  doc: Review Getting Started (#2650)
  Move annotations-reference to attributes-reference (#2651)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants