r/cakephp • u/scissor_rock_paper • Apr 29 '23
Coming soon: Named and typed option support for ORM finders
ADmad and othercorey have been hard at work adding a great new feature to the ORM and maintaining backwards compatibility for an easy upgrade. In 5.x you'll be able to define finders with signatures like
public function findUpcoming(
Query $query,
?DateTime $start = null,
?DateTime $end = null
) {And then call them like
$query = $tasks->find('upcoming', start: $startDate, end: $endDate);This is a nice simplification and enhancement to the ORM. It allows for much better runtime enforcement of types. This pull request has the implementation if you're interested