Bug fix: The entity selector was not constructing union queries correctly in php 5. The problem arose when add_right_relationship_field or add_left_relationship_field was called with false as the 5th argument.