Skip to content
This repository was archived by the owner on May 14, 2022. It is now read-only.

Conversation

@arseniew
Copy link

Since joinName is generated using base entity and related entity in case of joining same table several times generated query was not correct. Prefixing joinName with field seems to fix this problem.

Fixed issue that was preventing ability to join one column multiple times.
@ChadSikorra
Copy link
Member

Interesting...what do you mean by joining the same table several times? Such like with Ticket below...?

"aoColumns": [
      { "mData": "firstName" },
      { "mData": "Ticket.description" },
      { "mData": "Ticket.name" }
    ]

I'm hesitant to change the structure of the join name because if someone is using a filter callback with a join name it would probably break it and leave them wondering what happened. And I apologize on such a late comment on this. I just haven't had the time to really maintain this bundle lately.

@arseniew
Copy link
Author

arseniew commented Feb 2, 2014

Hello, thank you for the reply.
Problem appears only when you join same column several times on different join conditions so, in raw sql i would do something like:

SELECT employees.firstName, department.value as department, position.value as position from employees 
LEFT JOIN dictionary AS department ON employees.department_id = department.id 
LEFT JOIN dictionary AS position ON employees.position_id = position.id;

I can recreate such a join in Doctrine easily, however DatatablesBundle would merge these two join conditions into one, thats why i needed to differentiate them.

But you are absolutely right, it would break backward compatibility when using callback. I didn't thought that through. Sorry for the confusion (That's my first pull request ... ever)

If you think it would be helpful i could create similar solution, but:

  • I will make sure column is joined for the first time it would receive exact same name as it does in original DatatablesBunle currently
  • Every other join of the same column will receive distinguishable and readable name
    Hopefully this would be backward compatible, yet would allow for using such joins as described above.

P.S.
Thanks for sharing this bundle! it might not seems so from my pull request, but i absolutely love it! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants