original_string: protected function referencesMany(string $entity, string $field, bool $cacheable = true)
      {
          $referencedIds = (array) $this->$field;
  
          if (ObjectIdUtils::isObjectId($referencedIds[0] ?? '')) {
              foreach ($referencedIds as $key => $value) {
                  $referencedIds[$key] = new ObjectId($value);
              }
          }
  
          $query = ['_id' => ['$in' => array_values($referencedIds)]];
  
          $entityInstance = Ioc::make($entity);
  
          if ($entityInstance instanceof Schema) {
              $dataMapper = Ioc::make(DataMapper::class);
              $dataMapper->setSchema($entityInstance);
  
              return $dataMapper->where($query, [], $cacheable);
          }
  
          return $entityInstance::where($query, [], $cacheable);
      }
code: protected function referencesMany(string $entity, string $field, bool $cacheable = true)
      {
          $referencedIds = (array) $this->$field;
  
          if (ObjectIdUtils::isObjectId($referencedIds[0] ?? '')) {
              foreach ($referencedIds as $key => $value) {
                  $referencedIds[$key] = new ObjectId($value);
              }
          }
  
          $query = ['_id' => ['$in' => array_values($referencedIds)]];
  
          $entityInstance = Ioc::make($entity);
  
          if ($entityInstance instanceof Schema) {
              $dataMapper = Ioc::make(DataMapper::class);
              $dataMapper->setSchema($entityInstance);
  
              return $dataMapper->where($query, [], $cacheable);
          }
  
          return $entityInstance::where($query, [], $cacheable);
      }
code_tokens: protected function referencesMany ( string $ entity , string $ field , bool $ cacheable = true ) { $ referencedIds = ( array ) $ this -> $ field ; if ( ObjectIdUtils :: isObjectId ( $ referencedIds [ 0 ] ?? '' ) ) { foreach ( $ referencedIds as $ key => $ value ) { $ referencedIds [ $ key ] = new ObjectId ( $ value ) ; } } $ query = [ '_id' => [ '$in' => array_values ( $ referencedIds ) ] ] ; $ entityInstance = Ioc :: make ( $ entity ) ; if ( $ entityInstance instanceof Schema ) { $ dataMapper = Ioc :: make ( DataMapper :: class ) ; $ dataMapper -> setSchema ( $ entityInstance ) ; return $ dataMapper -> where ( $ query , [ ] , $ cacheable ) ; } return $ entityInstance :: where ( $ query , [ ] , $ cacheable ) ; }
docstring: Returns the cursor for the referenced documents as objects.
  
  @param string $entity    class of the entity or of the schema of the entity
  @param string $field     the field where the _ids are stored
  @param bool   $cacheable retrieves a CacheableCursor instead
  
  @return array
docstring_tokens: Returns the cursor for the referenced documents as objects .