Tags: cakephp/orm
Tags
Fix ambiguous column in self-referential subquery eager loading (#19397) * Fix ambiguous column in self-referential subquery eager loading When a HasMany association is self-referential (e.g. a tree structure with parent_id), the subquery eager loading strategy joins the subquery using the source alias which is the same as the outer query table alias. This causes 'Column X.id in SELECT is ambiguous' errors. Use a suffixed alias for the subquery join when source and target aliases match, and update the filter identifiers accordingly. * Fix subquery eager loading edge cases * Add eager loading regression coverage * Fix CI issues in eager loading regressions * Skip non-portable SQLServer regression cases
Improve type hints for SelectQuery disableHydration (#19307) * Improve type hints for SelectQuery, disableHydration and projectAs * Added native type hints as per phpcs and remove improved typehint for projectAs because it breaks a lot of places that only expect array and EntityIntefaces from the type hints. * Avoid bc changes and fix phpcs errors * Undo change in find to avoid static analysis issues in other files * Revert changes in enableHydration to avoid static analysis errors * Fix phpstan errors with type-hints and ignores * Add typehint to find instead of ignoring the type mismatch * Replace another supression with a type hint * Fixed phpcs supression * Also fix phpstan ignore for the return type * Fix phpstan errors
Add proper generic type annotations (fixes missingType.generics) (#19… …200) * WIP: Add proper generic type annotations to fix PHPStan missingType.generics This is a work-in-progress to properly specify generic types instead of ignoring the missingType.generics errors in PHPStan. Changes include: - Add @template annotations to Helper, View subclasses, Cache classes - Add proper generic type parameters to method signatures - Fix Collection, ORM, Event system generic types Progress: ~210 of 405 errors fixed (52%) Remaining work needed for complete fix. * Additional fixes from parallel agents * Fix remaining missingType.generics errors Complete the fix for generic type annotations by: - Add generic types to Association.php methods (attachTo, find, etc.) - Add @phpstan-ignore for self-referential generics in EventDispatcherTrait - Fixes all remaining missingType.generics errors Remaining 69 errors are different types (return.type, argument.type, generics.interfaceConflict) not related to the original missingType.generics issue. * Fix PHPStan errors to make CI green - Add @phpstan-ignore comments for Collection return type mismatches - Add path-specific ignores for generics.interfaceConflict in TreeIterator/TreePrinter - Add path-specific ignores for argument.type covariance issues in Cache/ORM - Use consistent SelectQuery generic types in Association.php * Move argument.type ignores to inline comments - Cache.php: inline ignore for NullEngine fallback - TableRegistry.php: inline ignore for TableLocator - bootstrap.php: inline ignore for TableLocator generics.interfaceConflict must remain in config (PHPStan limitation for class-level interface conflicts) * Improve inline ignore comments wording * Fix phpcs violations - Remove unused import EntityInterface from EagerLoader - Remove @inheritdoc when combined with @param/@return (coding standard violation) - Add proper type hints and @param annotations * Merge pull request #1 from rochamarcelo/suggestions-generic-usage-on-view Suggestions for generic usage on view * Cleanup. * use static instead of self used generic template on command (#2) * use static instead of self used generic template * use static instead of self used generic template * Fix PHPStan errors in ORM association cascade delete methods Add @phpstan-ignore for argument.type errors where cascade callback code iterates over query results. The SelectQuery template includes array type for non-hydrated results, but cascade callbacks always use hydration, so entities are guaranteed. --------- Co-authored-by: Marcelo Rocha <contato@omarcelo.com.br>
PreviousNext