File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -817,8 +817,19 @@ protected function autoJoinFK($key) {
817817 $ joinTreeNode =& $ this ->joinTree [$ baseTableAlias ];
818818
819819 $ useBridgeTable = FALSE ;
820+ $ baseTable = $ explicitJoin ['table ' ] ?? $ this ->getFrom ();
821+ // The base table may not resolve to a string - e.g. getFrom() returns
822+ // NULL when the entity's table mapping is not available yet.
823+ // Joiner::getPath() is typed `string $baseTable`, so passing NULL would
824+ // throw an uncaught \TypeError rather than the \CRM_Core_Exception handled
825+ // below. Since the select clause silently ignores unknown fields (see the
826+ // fallback in the catch block), this function should not throw - bail out
827+ // gracefully instead of fataling.
828+ if (!is_string ($ baseTable )) {
829+ return ;
830+ }
820831 try {
821- $ joinPath = $ joiner ->getPath ($ explicitJoin [ ' table ' ] ?? $ this -> getFrom () , $ pathArray );
832+ $ joinPath = $ joiner ->getPath ($ baseTable , $ pathArray );
822833 }
823834 catch (\CRM_Core_Exception $ e ) {
824835 if (!empty ($ explicitJoin ['bridge ' ])) {
You can’t perform that action at this time.
0 commit comments