Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/QueryObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,11 @@ public static function doPostFetch(EntityManagerInterface $em, array $rootEntiti
$childrenFieldNames = []; // fieldName => childrenFieldNames

foreach ($fieldNames as $fieldName) {
if (is_callable($fieldName)) {
$fieldName($em, $rootEntities);
continue;
}

if (!Strings::contains($fieldName, '.')) {
// fetch jen pro toto pole
$currentFieldNames[] = $fieldName;
Expand Down Expand Up @@ -916,10 +921,10 @@ final public function postFetch(Iterator $iterator): void

/**
* Přidá pole do seznamu pro postFetch.
* @param string $fieldName Může být název pole (např. "contact") nebo cesta (např. "commission.contract.client").
* @param string|callable $fieldName Může být název pole (např. "contact") nebo cesta (např. "commission.contract.client").
* @return $this
*/
final public function addPostFetch(string $fieldName): static
final public function addPostFetch(string|callable $fieldName): static
{
$this->postFetch[] = $fieldName;
return $this;
Expand Down