Recovers the Progams of the Array of id.

@param array(int) $ids The array of id.
@return array(Program) The programs that was found
@throws exception\ProgramNotFound If there is a SQL error
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;
   }
260365
protected function _getFindConfig(array $ids)
    {
        $config = (array)$this->getConfig('findConfig');
        if (!empty($config)) {
            return $config;
        }

        $primaryKey = $this->_table()->getPrimaryKey();
        $config['conditions'] = [];
        $config['conditions'][] = function ($exp) use ($primaryKey, $ids) {
            return $exp->in($primaryKey, $ids);
        };

        return $config;
    }
96645
private function parseIds(array $ids)
    {
        $ids = \array_map('intval', $ids);
        $ids = \array_filter($ids);
        $ids = \array_unique($ids);

        return \array_values($ids);
    }
686555
private function getItemById(array $ids)
    {
        $ids = array_map('intval', $ids);

        try {
            $stmtResult = $this->neo4jClient->run('MATCH (n) WHERE ID(n) IN {ids} RETURN n', ['ids' => $ids]);
        } catch (\Exception $e) {
            return [];
        }

        $result = [];

        if (!$stmtResult->size()) {
            return $result;
        }

        foreach ($stmtResult->records() as $record) {
            $result[] = $record->get('n');
        }

        return $result;
    }
748572
protected function _ctx_ids($ids = null)
    {
        $m   = -1;
        $exc = $this->exc;
        if (!isset($ids)) {
            $ids = $this->ids;
        } elseif (is_int($ids)) {
            $ids = isset($this->ids[$ids]) ? array($ids => $this->ids[$ids]) : self::$_fl_;
        } else {
            foreach ($ids as $b => $e) {
                if ($b <= $m || $b + 1 >= $e and empty($exc[$b])) {
                    unset($ids[$b]);
                } else {
                    $m = $e;
                }

            }
        }
        return $ids;
    }
633842
public function findMany($ids, $columns = ['*'])
    {
        if (empty($ids)) {
            return $this->model->newCollection();
        }

        return $this->whereKey($ids)->get($columns);
    }
1187419
final public function find($ids=[]) {
      if (func_num_args()>0) {
         if (func_num_args()===1) {
            if (!is_array($ids)) {
               $ids = (array) $ids ;
            }
         }
         else {
            $ids = func_get_args();
         }
      }

      $closure = NULL;
      if ( count(func_get_args())>1 ) {
         if ( $ids[count($ids)-1] instanceof \Closure ) {
            $closure = array_pop($ids);
         }
         if (is_array($ids[0])) {
            $ids = $ids[0];
         }
      }

      $this->find_first_data = $this->find_save_data = $this->find_delete_data = TRUE;

      if ( count($ids) && !(@$ids[0] instanceof \Closure) ) {
         if ( $this->is_assoc( $ids ) ) {
            $this->where( $ids );
         }
         else {
            $this->where( $this->primaryKey, 'in', $ids );
         }
      }

      $this->get();

      if (count($ids)===1 && count($this->data)===1) {
         $this->data = $this->data[0];
      }

      if ($closure instanceof \Closure) {
         $this->data = $closure( $this->data, $this );
      }

      return $this;
   }
82233
protected function doFetch(array $ids)
    {
        if ( ! $ids) {
            return [];
        }

        return $this->redis->hmget($this->namespace, $this->keys($ids));
    }
932995
protected function _getIds(array $ids, $primaryKey = self::PRIMARY_KEY)
    {
        $return = [];
        foreach ($ids as $id => $value) {
            if (is_array($value) && is_int($id) && (int) $value[$primaryKey] === 1) {
                $return[$id] = $id;
            }
        }

        return $return;
    }
1019423
public function findByIds(array $ids)
    {
        $args = [];
        $manager = $this->getManager();
        $args['body']['docs'] = [];
        $args['index'] = $manager->getIndexName();
        $args['type'] = $this->getType();

        foreach ($ids as $id) {
            $args['body']['docs'][] = [
                '_id' => $id
            ];
        }

        $mgetResponse = $manager->getClient()->mget($args);

        $return = [
            'hits' => [
                'hits' => [],
                'total' => 0,
            ]
        ];

        foreach ($mgetResponse['docs'] as $item) {
            if ($item['found']) {
                $return['hits']['hits'][] = $item;
            }
        }

        $return['hits']['total'] = count($return['hits']['hits']);

        return new DocumentIterator($return, $manager);
    }
1261020
public function selectByIds(array $ids = array())
    {
        if (empty($ids)) {
            return array();
        }

        $ids = array_map('intval', $ids);

        $sql = $this->getSelectQueryByIds($ids);

        $resultSet = $this->db->fetchAll($sql);

        return $this->implementVOs($resultSet);
    }
525744
private function groupIdsByFile(array $ids) : array
    {
        $covered = [];

        foreach ($ids as $id) {
            $file = mb_substr($id, 0, (int) mb_strpos($id, '::'));

            if (!isset($covered[$file])) {
                $covered[$file] = [];
            }

            $covered[$file][] = mb_substr($id, mb_strpos($id, '::') + 2);
        }

        return $covered;
    }
1153271
public static function get_many(array $ids) {
        global $DB;
        $coursecatrecordcache = cache::make('core', 'coursecatrecords');
        $categories = $coursecatrecordcache->get_many($ids);
        $toload = array();
        foreach ($categories as $id => $result) {
            if ($result === false) {
                $toload[] = $id;
            }
        }
        if (!empty($toload)) {
            list($where, $params) = $DB->get_in_or_equal($toload, SQL_PARAMS_NAMED);
            $records = self::get_records('cc.id '.$where, $params);
            $toset = array();
            foreach ($records as $record) {
                $categories[$record->id] = new self($record);
                $toset[$record->id] = $categories[$record->id];
            }
            $coursecatrecordcache->set_many($toset);
        }
        return $categories;
    }
1087920
protected function deleteFromDB($ids=null)
    {

        $query = "DELETE FROM {$this->quotedTable}";

        if ($ids == null) {
            $this->connection->write($query, [], false);
            return;
        }

        $query .= " WHERE {$this->quotedIdKey} IN ";

        $quotedIds = array_map(function ($id) {
            return $this->dialect->quote($id, 'string');
        },(array)$ids);

        $this->connection->write($query . "\n(" . implode(',', $quotedIds) . ')', [], false);

    }
731228
public function id($ids){
        $ids = (array)$ids;
        if (count($ids) !== count($this->config['pkeys']))
            throw new Exception('Unmatched id count ' . count($ids)
                                . ':' . count($this->config['pkeys']));
        $pkeys = $this->config['pkeys'];
        foreach ($pkeys as $i => $pkey)
            $this->where->eq(array($this->voName . '.' . Util::toVoName($pkey) =>$ids[$i]));

        return $this;
    }
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();
    }