Skip to content

Conversation

@Haehnchen
Copy link
Owner

now we have also some doctrine support. :)

doctrine
doctrine_click
repo
entity

@Lumbendil
Copy link
Contributor

It'd be great if you parsed the Entity annotation to know if the class has a custom repository, and in such case, changed the class return of getRepository to that class.

Other than that, great job! 👍

@Haehnchen
Copy link
Owner Author

yeah there is much todo. iam currently working on this :)

@Lumbendil
Copy link
Contributor

Great! Then it'd be nice that you edited your issue and you marked it as [WIP] so it's possible to see that the PR isn't at a finished state.

@Haehnchen
Copy link
Owner Author

looks ready to me at least of:

  • iam no parsing the position of the repository class, only use default one on entityname. too heavy in the moment
  • if repository autocomplete is used on the repository class instead of the entity class, the later event for the entity autocomplete is not fired on phpstorm
@adrienbrault
Copy link
Contributor

In the container.xml file, inside the <service id="doctrine.orm.default_entity_manager"> definition, there is somewhere:

<call method="setEntityNamespaces"> <argument type="collection"> <argument key="SupFarmBundle">SupFarmBundle\Entity</argument> <argument key="FOSUserBundle">FOS\UserBundle\Entity</argument> <argument key="SonataUserBundle">Sonata\UserBundle\Entity</argument> </argument> </call> 

Maybe it'd be better to rely on this to resolve AcmeFooBundle:User strings.

@adrienbrault
Copy link
Contributor

I think that you could also support findXXX methods on the repository if you returned a "EntityFQN[]" type. This is probably possible since you can do @return User[] in docblocks.

@Lumbendil
Copy link
Contributor

Also, in this PR or after this is merged it'd be nice to have support for the magic methods findByXXXX and findOneByXXXX

Conflicts:	src/fr/adrienbrault/idea/symfony2plugin/Symfony2ProjectComponent.java	src/fr/adrienbrault/idea/symfony2plugin/SymfonyInterfacesHelper.java
@Haehnchen
Copy link
Owner Author

thx for the new Symfony2InterfacesUtil. now Repository classes resolved corrent on interfaces

@Lumbendil
Copy link
Contributor

Does this PR support resolution of target entities?

http://symfony.com/doc/master/cookbook/doctrine/resolve_target_entity.html

Copy link
Contributor

Choose a reason for hiding this comment

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

isGetRepositoryCall would be a better name imho

@Haehnchen
Copy link
Owner Author

do anyone see problems on merging it now?. i have two TODOs mentioned in commits, but i want to look later for a better solution. currently this feature works good on a big symfony2 at worktime, and save me lot of time. furthermore i have many more in pipe and want to close this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not using a xpath query ?

Copy link
Contributor

Choose a reason for hiding this comment

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

you should also support \\Doctrine\\Common\\Persistence\\ObjectManager::getRepository for people getting the repository from the EntityManager

@lunetics
Copy link

+1 thumbs up for the good work @Haehnchen

Copy link
Contributor

Choose a reason for hiding this comment

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

What if the user has an entity named Repository because he is managing a Repository ?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you really want to exclude the repositories, maybe using Symfony2InterfacesUtil.isInstanceOf would work

Copy link
Contributor

Choose a reason for hiding this comment

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

Replacing / with \ should work, right ?

adrienbrault added a commit that referenced this pull request May 4, 2013
@adrienbrault adrienbrault merged commit a8883fc into Haehnchen:master May 4, 2013
@adrienbrault
Copy link
Contributor

Really awesome, thanks!

@Haehnchen Haehnchen deleted the feature/doctrine-support branch May 5, 2013 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants