scoumbourdis/grocery-crud — pull request #83 by nehpetz6 (2012-08-14 22:12:22+00:00)
Title: Fixed problem with n_n_relation using same table for selection and primary table

The problem comes when you try to build a many to many relationship between a field in one table and another field in the same table.

For example, a table called pages has a primary key called id and another field called parent. The parent field references the id field of the pages table.

The fix was adding an alias to mentions of this->table_name used in the "from" portion of most select queries in grocery_crud_model.php

This has been tested and works correctly under normal use. Possible break points invovle queries which alter the table name (not set_table) or set_basic_table or get_field_types_basic_table -- however, these functions are assumed to work.