0

That is simple for you, but I can't understand the difference (if it exist) between two "name" of this same class:

First if I use php function (get_class()) for some entity I get something like structure to directory to class of this object (App\Module\Class).

Second: If i want to get some data form db I have to use a repository name as AppModule:Class

So is there any method to transform first naming to second? I don't know how you naming this two methods, I am sorry for my mistakes.

1
  • Don't confuse Doctine's AppModule:Class with PHP's AppModule::Class. In the land of Doctine the AppModule is an alias which end up pointing to AppModule\Entity. Class is then appended to it. Commented Sep 21, 2017 at 12:56

1 Answer 1

1

If you use ClassName::class where ClassName is whatever a class is, you'll obtain the class FQCN (Fully Qualified Class Name; in your example, for instance, App\Module\Class)

I suggest to use ClassName::class every time you can instead of VendoBundle:Class convention

This will work only if you use PHP >= 5.5 btw, but I hope you do!

Sign up to request clarification or add additional context in comments.

2 Comments

Thak you for answer. Is exist any (built-in) method to convert this two names? Like "App\Module\Class" to "AppModule:Class" ?
@Micchaleq I don't think so. However you don't need the second one, you can use what I've suggested even for repository retrieve. Give it a try!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.