Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

change targetEntity format#10696

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
osavchenko wants to merge1 commit intosymfony:masterfromosavchenko:changes_according_to_doctrine2
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionbest_practices/business-logic.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -198,7 +198,7 @@ looking for mapping information::

/**
* @ORM\OneToMany(
* targetEntity="Comment",
* targetEntity="App\Entity\Comment",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better to suggestComment::class because if you refactor namespace it will be picked up and you don't have to edit a bunch of strings

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The similar approach was applied before, so I decide to follow it. Do you want to suggest rework everywhere toClassNmae::class?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, then leave it like this in PR. I think reworking it everywhere would be a nice addition. Not sure what docs team thinks about it

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

If team decide to rework everything, so, I'm in ;)

Copy link
Member

Choose a reason for hiding this comment

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

Using the class constant doesn't work in annotations if I am not completely mistaken.

Copy link
Contributor

Choose a reason for hiding this comment

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

It works, I used it like:

     * @ORM\ManyToOne(targetEntity=Comment::class)     * @ORM\JoinColumn(name="id", referencedColumnName="id")

When you refactor and maybe change the namespace, it changes the use statements (not sure about strings but it didn't work for me most of the times) so that is an advantage on usingComment::class instead of"App\Entity\Comment".

Copy link
Contributor

@kunicmarko20kunicmarko20Nov 25, 2018
edited
Loading

Choose a reason for hiding this comment

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

After discussing this with@ostrolucky on slack, it seems that:

clicking onmappedBy="foo"/inversedBy="foo"

dosen't work withComment::class also if you rename the class it still staysComment::class so I guess FQCN is still better

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

You mean "clicking on" IDE?

Copy link
Contributor

Choose a reason for hiding this comment

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

ye, clicking on the name of the var in your IDE (phpstorm in my case).

* mappedBy="post",
* orphanRemoval=true
* )
Expand Down
4 changes: 2 additions & 2 deletionsform/form_collections.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -468,7 +468,7 @@ you will learn about next!).
// ...

/**
* @ORM\ManyToMany(targetEntity="Tag", cascade={"persist"})
* @ORM\ManyToMany(targetEntity="App\Entity\Tag", cascade={"persist"})
*/
protected $tags;

Expand All@@ -480,7 +480,7 @@ you will learn about next!).
# ...
oneToMany:
tags:
targetEntity: Tag
targetEntity:App\Entity\Tag
cascade: [persist]

.. code-block:: xml
Expand Down
2 changes: 1 addition & 1 deletionreference/constraints/UniqueEntity.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -218,7 +218,7 @@ Consider this example:
class Service
{
/**
* @ORM\ManyToOne(targetEntity="Host")
* @ORM\ManyToOne(targetEntity="App\Entity\Host")
*/
public $host;

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp