Sanitize a list of numeric IDs, and return the same format
@param array/string $ids (array or comma-separated list)
@return array/string (same as input type)
512695
public static function sanitizeIDs($ids)
    {
        if (!is_array($ids)) {
            $return_string = true;
            $ids = explode(',', $ids);
        }
        if (!Arr::iterable($ids)) {
            return false;
        }

        $ids = array_map('trim', $ids);
        $ids = array_filter($ids, 'strlen');
        $ids = array_map('intval', $ids);
        $ids = array_map('abs', $ids);

        return ($return_string)
            ? join(',', $ids)
            : $ids;
    }
719106
protected function getLr($ids)
    {
        $class = $this->className;
        return $class::find()
            ->select(['id', $this->leftAttribute, $this->rightAttribute])
            ->where(['id' => $ids])
            ->indexBy('id')
            ->asArray(true)
            ->all();
    }
868951
public static function destroy($ids)
    {
        $count = 0;

        $ids = is_array($ids) ? $ids : func_get_args();

        // Criar instancia do model
        $instance = new static;

        foreach ($instance->query()->whereIn('_id', $ids)->get() as $model) {
            if ($model->delete()) {
                $count++;
            }
        }

        return $count;
    }
219090
public function several(array $ids)
    {
        $results = [];
        foreach ($this->getEntry($ids) as $cacheId=>$entry) {
            if (!$this->isExpired($entry)) {
                $results[$cacheId] =  $this->getPayload($cacheId, $entry);
            }
        }

        return $results;
    }
815753
public function findActionsForIds(array $ids)
    {
        if (empty($ids)) {
            return array();
        }

        $datas = $this->client->hmget($this->getActionKey(), $ids);

        return array_values(
            array_map(
                function ($v) {
                    return unserialize($v);
                },
                $datas
            )
        );
    }
338998
public function setList(array $ids)
    {
        $this->ids = $ids;
        $this->count = count($ids);
        return $this;
    }
571952
public function getFormJson(array $ids)
    {
        $values = [];
        foreach ($this->getValues($ids) as $id => $value) {
            $id = strtolower(preg_replace('/[A-Z]/', '-$0', strtr($id, ['.' => '-', '_' => '-'])));
            $values['js-' . $id] = $value;
        }

        return json_encode($values, JSON_UNESCAPED_UNICODE);
    }
277049
public function getMany(array $ids) {
		$data = [];
		
		foreach ($ids as $id) {
			$result = $this->get($id);
			
			if ($result !== false) {
				$data[$id] = $result;
			}
		}
		
		return $data;
	}
1097578
public function presences($ids) {
        if(is_array($ids)) $ids =  implode(",", $ids);
		$data = $this->reqdata();
        $data['ids'] = $ids;
        return $this->request('presences', $data);
    }
424750
public function getWishlistByIds($ids)
    {
        $collection = $this->wishlist->create()
            ->getCollection()
            ->addFieldToFilter('main_table.wishlist_id', ['in' => $ids])
            ->addFieldToFilter('customer_id', ['notnull' => 'true']);

        $collection->getSelect()
            ->joinLeft(
                ['c' => $this->getTable('customer_entity')],
                'c.entity_id = customer_id',
                ['email', 'store_id']
            );

        return $collection;
    }
339670
public function several(array $ids)
    {
        $result = [];
        foreach ($ids as $id) {
            if ($this->has($id)) {
                $result[$id] = $this->get($id);
            }
        }
        return $result;

    }
1370874
public function findByIds($ids)
    {
        if (!is_array($ids)) {
            $ids = explode(',', trim($ids));
        }

        return $this->createQueryBuilder('o')
            ->where('o.id IN (:ids)')
            ->setParameters([
                'ids' => $ids,
            ])
            ->getQuery()
            ->getResult();
    }
899229
public static function parseIds($ids)
    {
        if (empty($ids)) {
            return [];
        }
        
        // 转换数字ID和字符串形式ID串为数组
        if (is_numeric($ids)) {
            $ids = [$ids];
        } else if (is_string($ids)) {
            $ids = self::stringToArray($ids);
        }
        
        $id_array = array_unique(array_filter(array_map('intval', $ids)));
        
        return 0 == count($id_array) ? [] : $id_array;
    }
1247040
public function idsAction($ids)
    {
        $items = $this->get('opifer.content.content_manager')
            ->getRepository()
            ->findByIds($ids);

        $contents = $this->get('jms_serializer')->serialize($items, 'json', SerializationContext::create()->setGroups(['list'])->enableMaxDepthChecks());

        $data = [
            'results'       => json_decode($contents, true),
            'total_results' => count($items)
        ];

        return new JsonResponse($data);
    }
514992
public function getProgramsArray($ids){

        $idString = "";
        foreach($ids as $id){
            $idString .=$id.',';
        }
        $idString = substr($idString, 0, strlen($idString)-1);

        try {
            $connection = $this->ext_connection->get_Connection();
            $prefix = $this->ext_connection->get_prefix();

            $sql2 = "SELECT *
                    FROM " . $prefix . "program p," . $prefix . "program_description d
                    WHERE prog_id IN (" . $idString . ")
                        AND prog_id = id_prog
                ORDER BY date DESC";

            $programs = array();
            if ($sql = $connection->query($sql2)) {

                while ($result = $sql->fetchObject()) {

                    if (isset($this->programs[$result->id_prog])) {
                        $programs[$result->id_prog] = $this->programs[$result->id_prog];
                    }else if(isset($programs[$result->id_prog])){
                        $programs[$result->id_prog]->addLanguage($result->lang, $result->short_desc, $result->vshort_desc);
                    }else {
                        $article = null;
                        try {
                            $article = $this->articles->getArticle($result->article_id);
                        } catch (\Exception $ex) {
                        }

                        $programs[$result->id_prog] =
                            new \Model\programs\Program    (
                                $result->id_prog,
                                $result->name,
                                $result->img,
                                $result->front_page == 1,
                                $this->categories->getElement($result->cat_id),
                                $article,
                                $result->date,
                                $result->gallery_path
                            );
                        $programs[$result->id_prog]->addLanguage($result->lang, $result->short_desc, $result->vshort_desc);
                    }
                }
            } else {
                throw new ProgramNotFound("Couldn't get Program of List : ".$idString." SQL ERROR2 "+$sql2, 0);
            }

            //Main program component gather, now let's get the rest of it.

            //First second categories
            $sql = "SELECT * FROM ".$prefix."program_category_category
                        WHERE prog_id IN (".$idString.")";

            if ($sql = $connection->query($sql)) {

                while ($result = $sql->fetchObject()) {
                    if(isset($programs[$result->prog_id])){
                        $programs[$result->prog_id]->addCategory($this->categories->getElement($result->category_id));
                    }
                }
            } else {
                throw new ProgramNotFound("Couldn't get Program of List : ".$idString." Error gathering secondary Categories", 0);
            }

            //Second secondary articles
            $sql2 = "SELECT * FROM ".$prefix."program_article
                        WHERE prog_id IN (".$idString.")";

            if ($sql = $connection->query($sql2)) {

                while ($result = $sql->fetchObject()) {
                    if(isset($programs[$result->prog_id])){
                        $programs[$result->prog_id]->addArticle($this->articles->getArticle($result->article_id));
                    }
                }
            } else {
                throw new ProgramNotFound("Couldn't get Program of List : ".$idString." Error gathering secondary Articles. ".$sql2, 0);
            }

            //Third loading versions
            $sql2 = "SELECT * FROM ".$prefix."program_version, ".$prefix."program_revision r
                        WHERE prog_id IN (".$idString.")
                            AND id_version = r.version_id
						ORDER BY  r.date DESC";

            if ($sql = $connection->query($sql2)) {

                $versions = array();

                while ($result = $sql->fetchObject()) {
                    if(isset($programs[$result->prog_id])){

                        if(!isset($versions[$result->id_version])){
                            $versions[$result->id_version] = new Version($result->id_version, $result->name, $result->desc);
                            $programs[$result->prog_id]->addVersion($versions[$result->id_version]);
                        }
                        $version = $versions[$result->id_version];
                        $version->addRevision(new Revision($result->revision_name, $result->date, $result->description, $result->dwld, $result->isBeta == 1));
                    }
                }
            } else {
                throw new ProgramNotFound("Couldn't get Program of List : ".$idString." Error gathering Revisions and Versions. ".$sql2, 0);
            }

            //Lest register the new programs in to the buffer
            foreach($programs as $id=>$program){
                $this->programs[$id] = $program;
            }


            return $programs;

        } catch (\Exception $ex) {
            throw new ProgramNotFound("Couldn't get Program of List : ".$idString." . SQL ERROR", 0, $ex);
        }

    }
986333
final public function delete( $ids = [] ) {
      if (func_num_args()>0) {
         if (func_num_args()==1) {
            if (!is_array($ids)) {
               $ids = (array) $ids;
            }
         }
         else {
            $ids = func_get_args();
         }
      }

      $this->connection();
      if ( $this->find_delete_data ) {
         if(is_object($this->data) && $this->data) {
            $ids[] = $this->data->{$this->primaryKey};
         }

         if(is_array($this->data) && $this->data) {
            foreach($this->data as $data)
               $ids[] = $data->{$this->primaryKey};
         }

         $this->find_delete_data = FALSE;

         if (!count( $ids )) {
            return FALSE;
         }
      }

      if ( $this->is_assoc( $ids ) ) {
         $this->where( $ids );
         $ids = NULL;
      }
      else {
         $this->placeholder_data = $ids;
         $placeholder = $this->get_placeholder($ids);
      }
      

      $where = '';
      if ( $ids ) {
         if (preg_match("/WHERE/", $this->where))
            $where = " {$this->where} AND {$this->primaryKey} IN({$placeholder}) ";
         else
            $where = " WHERE {$this->primaryKey} IN({$placeholder}) ";
      }
      else {
         if (preg_match("/WHERE/", $this->where))
            $where = $this->where;
      }

      $schema = '';
      if($this->driver=='pgsql' && $this->schema) {
         if (!preg_match('/\./', $this->table)) {
            $schema = $this->schema ? $this->schema.'.' : '';	
         }
      }

      $this->last_sql = $this->sql = "DELETE FROM {$schema}{$this->table} {$where}";

      // $this->fetch(false);
      $this->fetch();

      $this->reset();

      if ( $this->tableOrig!==null ) {
         $this->table = $this->tableOrig;
      }

      $error = $this->error();
      return $error['message'] ? false : true;
   }
1025799
public function getByIds($ids, $prepareResults = true)
    {
        $queryBuilder = $this->getSelectQueryBuilder();
        $connection   = $queryBuilder->getConnection();
        $rows         = $queryBuilder->where(
            $queryBuilder->expr()->in($this->getUniqueId(), array_map(function ($id) use ($connection) {
                return $connection->quote($id);
            }, $ids))
        )->execute()->fetchAll();

        if ($prepareResults) {
            $this->prepareResults($rows);
        }

        return $rows;
    }