-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Migrate more documentation towards attributes #10157
Migrate more documentation towards attributes #10157
Conversation
151f0c7
to
82ffb64
Compare
I also added another commit to address @stof 's comment |
@@ -154,7 +154,7 @@ As you can see, we have a method "setBlockEntity" which ties a potential strateg | |||
* This var contains the classname of the strategy | |||
* that is used for this blockitem. (This string (!) value will be persisted by Doctrine ORM) | |||
* | |||
* This is a doctrine field, so make sure that you use an @column annotation or setup your | |||
* This is a doctrine field, so make sure that you use an @[Column] attribute or setup your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not be a @
here
@@ -53,20 +53,17 @@ code, enforcing it at any time is important so that customers with | |||
a unknown reputation don't owe your business too much money. | |||
|
|||
We can enforce this constraint in any of the metadata drivers. | |||
First Annotations: | |||
First Attributes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the doc below shows other formats. So maybe it should keep annotations as well.
And for Yaml, there is a sentence saying this will happen before Beta 1 though
which looks totally wrong in the doc (and it does not say beta 1 of which version)
@@ -124,18 +125,18 @@ used in the examples. For information on the usage of the | |||
AnnotationDriver, XmlDriver or YamlDriver please refer to the dedicated | |||
chapters ``Annotation Reference``, ``XML Mapping`` and ``YAML Mapping``. | |||
|
|||
The annotation driver can be configured with a factory method on | |||
The attribute driver can be configured with a factory method on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no factory method (and before, it was not on the Configuration class)
@@ -37,7 +37,28 @@ A many-to-one association is the most common association between objects. Exampl | |||
|
|||
.. configuration-block:: | |||
|
|||
.. code-block:: php | |||
.. code-block:: annotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put attribute before annotation, as attribute is the default in the docs
docs/en/reference/basic-mapping.rst
Outdated
@@ -437,7 +451,7 @@ Here is the list of possible generation strategies: | |||
thus generated) by your code. The assignment must take place before | |||
a new entity is passed to ``EntityManager#persist``. NONE is the | |||
same as leaving off the @GeneratedValue entirely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GeneratedValue
should be replaced too, meaning the attribute instead
$config = ORMSetup::createAttributeMetadataConfiguration( | ||
paths: array(__DIR__."/src"), | ||
isDevMode: true, | ||
); | ||
// or if you prefer YAML or XML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have a or if you prefer annotation
?
$this->longitude = $longitude; | ||
public function __construct( | ||
private float $latitude, | ||
private float$longitude, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private float$longitude, | |
private float $longitude, |
@@ -154,7 +154,7 @@ As you can see, we have a method "setBlockEntity" which ties a potential strateg | |||
* This var contains the classname of the strategy | |||
* that is used for this blockitem. (This string (!) value will be persisted by Doctrine ORM) | |||
* | |||
* This is a doctrine field, so make sure that you use an @column annotation or setup your | |||
* This is a doctrine field, so make sure that you use an @[Column] attribute or setup your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* This is a doctrine field, so make sure that you use an @[Column] attribute or setup your | |
* This is a doctrine field, so make sure that you use an #[Column] attribute or setup your |
#[Column(type: 'point')] | ||
private Point $point; | ||
|
||
#[Column()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[Column()] | |
#[Column] |
docs/en/reference/events.rst
Outdated
class UserListener | ||
{ | ||
#[PrePersist] | ||
public function prePersistHandler(User $user, LifecycleEventArgs $event) { // ... } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we make the return type explicit to indicate that we don't expect the listener to return anything?
public function prePersistHandler(User $user, LifecycleEventArgs $event) { // ... } | |
public function prePersistHandler(User $user, LifecycleEventArgs $event): void { // ... } |
The previous rework missed some details / left the documentation in an inconsistent state. Searching for "annotation" case insensitively allows to find discrepancies and forgotten things.
e97c1f3
to
4e445fe
Compare
The previous rework missed some details / left the documentation in an inconsistent state. Searching for "annotation" case insensitively allows to find discrepancies and forgotten things.