- Issue created by @Mehrdad201
- 🇮🇷Iran Mehrdad201
I found that problem happened because pf getRandomAd function.
getRandomAd function located at AdContentBucket.php only same the first item of each size and it seems random selector doesn't work.
because every time after running the bellow code
$result = $query ->range(0, 1) ->sort('id') ->execute();
the first record of selected size is received and loaded to ad_content variable.
I changed the code and now it works but I am not sure that what I have done is true or false.
here is my changed code:
$result = $query //->range(0, 1) ->sort('id') ->execute(); if ($result) { shuffle($result) /** @var \Drupal\ad_content\Entity\AdContentInterface $ad_content */ $ad_content = $storage->load(reset($result)); }