Возвращает объект по ID и "Типу материалов".

@param int $id ID объекта
@param int $type "Тип материалов" объекта
@param string $table Таблица БД, в которой хранятся поля объекта
@return DynamicFieldsObject
165470
public static function getByIdType($id, $type)
    {
        $o = self::factory($type);
		$o->load($id);
        return $o;
    }
1015196
public function importDownload(string $id, string $type = 'original') : Response
    {
        $table = TableRegistry::get('CsvMigrations.Imports');
        $entity = $table->get($id);
        Assert::isInstanceOf($entity, Import::class);

        $path = $entity->get('filename');
        if ('processed' === $type) {
            $path = ImportUtility::getProcessedFile($entity);
        }

        return $this->response->withFile($path, ['download' => true]);
    }
636877
public function generateNewId($table)
    {
        if (!isset($this->idCounterByTable[$table])) {
            $this->idCounterByTable[$table] = $this->getSQLBuilder()->select($table)->field('id')->orderDesc('id')->limit(0, 1)->fetchResult();
        }

        for ($i = 0; $i < 50; $i++) {
            $this->idCounterByTable[$table]++;

            if ($this->getCache()) {
                $key = 'grace_id_gen_' . $table . '_' . strval($this->idCounterByTable[$table]);

                $isBusy = $this->getCache()->get($key);
                if ($isBusy === null) {
                    $this->getCache()->set($key, '1', 60);
                    return $this->idCounterByTable[$table];
                }
            } else {
                return $this->idCounterByTable[$table];
            }
        }

        throw new \OutOfBoundsException('Maximum number of cycles to generate new id has reached');
    }
989069
protected function buildTemplateIdentifier($id, $type = self::TEMPLATE_IDENTIFIER_FORM)
    {
        $type = strtoupper($type);

        return self::TEMPLATE_BRACKETS_OPEN.
            self::TEMPLATE_PREFIX.
            $type.
            '-'.
            $id.
            self::TEMPLATE_BRACKETS_CLOSE;
    }
469659
protected function getTypeById($type, $id)
    {
        $items = isset($this->$type) ? $this->$type : [];

        if (false === isset($items[$id])) {
            throw new \RuntimeException(sprintf("Unknown %s item with id '%s'", $type, $id), 404);
        }

        return $items[$id];
    }
467713
public function getSource($index, $type, $id)
    {
        return $this->db->get([$index, $type, $id]);
    }
240324
public function get($index, $type, $id)
    {
        $request = $this->createRequestInstance(self::GET_DOCUMENT, $index, $type);
        $request->setId($id);

        return $this->client->send($request);
    }
393634
protected function pregRegistry(int $id, array $types)
    {
        $registry_types = Utils\Utils::arrayWhitelist(
            self::$cache[$this->config]['registries'],
            $types
        );

        $result = null;
        foreach ($registry_types as $type => $matcher) {
            if (preg_match(
                $matcher['pattern'],
                $this->registries[$id] ?? '',
                $matches
            )) {
                $match = array_combine(
                    $matcher['map'],
                    array_map('trim', array_slice($matches, 1))
                );
                $result = new Registry($this->config, $type, $match);
                break;
            }
        }
        return $result;
    }
1277538
public function getIdRuesFrom($id, $type = '')
    {

        $arrayIdRues=array();

        switch ($type) {
            case 'ville':
                $reqVilles = "
						SELECT distinct r.idRue as idRue, lower(substr(r.nom,1,1)) as lettre
						FROM rue r
						RIGHT JOIN historiqueAdresse ha ON ha.idRue = r.idRue
						RIGHT JOIN sousQuartier sq ON sq.idSousQuartier = r.idSousQuartier
						RIGHT JOIN quartier q ON q.idQuartier = sq.idQuartier
						RIGHT JOIN ville v ON q.idVille = v.idVille
						WHERE v.idVille = '".$id."'
								AND r.idRue IS NOT NULL
								ORDER BY lettre
								";

                $resVilles = $this->connexionBdd->requete($reqVilles);

                while ($fetchVilles = mysql_fetch_assoc($resVilles)) {
                    $arrayIdRues[] = $fetchVilles['idRue'];
                }
                break;
            case 'pays':
                $reqVilles = "
						SELECT distinct r.idRue as idRue, lower(substr(r.nom,1,1)) as lettre
						FROM rue r
						RIGHT JOIN historiqueAdresse ha ON ha.idRue = r.idRue
						RIGHT JOIN sousQuartier sq ON sq.idSousQuartier = r.idSousQuartier
						RIGHT JOIN quartier q ON q.idQuartier = sq.idQuartier
						RIGHT JOIN ville v ON q.idVille = v.idVille
						WHERE v.idPays = '".$id."'
								AND r.idRue IS NOT NULL
								ORDER BY lettre
								";

                $resVilles = $this->connexionBdd->requete($reqVilles);

                while ($fetchVilles = mysql_fetch_assoc($resVilles)) {
                    $arrayIdRues[] = $fetchVilles['idRue'];
                }
                break;
            case 'quartier':
                $req = "
						SELECT r.idRue as idRue
						FROM rue r
						LEFT JOIN sousQuartier sq ON sq.idSousQuartier = r.idSousQuartier
						LEFT JOIN quartier q ON q.idQuartier = sq.idQuartier
						WHERE q.idQuartier = '".$id."'
								ORDER BY r.nom
								";
                $res = $this->connexionBdd->requete($req);
                while ($fetch = mysql_fetch_assoc($res)) {
                    $arrayIdRues[] = $fetch['idRue'];
                }
                break;

            case 'sousQuartier':
                break;
            case 'idAdresse':
                $req = "
						SELECT ha1.idRue as idRue
						FROM historiqueAdresse ha2, historiqueAdresse ha1
						WHERE
						ha1.idAdresse = '".$id."'
								AND ha2.idAdresse = ha1.idAdresse
								GROUP BY ha1.idAdresse, ha1.idHistoriqueAdresse
								HAVING ha1.idHistoriqueAdresse = max(ha2.idHistoriqueAdresse)
								";
                $res = $this->connexionBdd->requete($req);
                $fetch = mysql_fetch_assoc($res);
                $arrayIdRues[0] = $fetch['idRue'];

                break;
        }

        return $arrayIdRues;
    }
850648
public function stepCreateRecordWithTable($type, $id, $null, TableNode $fieldsTable) {
		$class = $this->convertTypeToClass($type);
		// TODO Support more than one record
		$fields = $this->convertFields($class, $fieldsTable->getRowsHash());
		$fields = $this->prepareFixture($class, $id, $fields);

		// We should check if this fixture object already exists - if it does, we update it. If not, we create it
		if($existingFixture = $this->fixtureFactory->get($class, $id)) {
			// Merge existing data with new data, and create new object to replace existing object
			foreach($fields as $k => $v) {
				$existingFixture->$k = $v;
			}
			$existingFixture->write();
		} else {
			$this->fixtureFactory->createObject($class, $id, $fields);
		}
	}
972925
public function delete($table = '', $id = '')
    {
        $sql = 'DELETE FROM '.$table.' WHERE id='.$id;
        echo $sql.'<br/>';
        return $this->execute($sql);
    }
878107
public function loadFile($type, $id) {
    $query = $this->connection->select('file_usage', 'n');
    $query->fields('n', array('fid'));
    $query->condition('n.module', 'site_commerce');
    $query->condition('n.type', $type);
    $query->condition('n.id', $id);
    $fid = $query->execute()->fetchField();
    $file = null;
    if ($fid) {
      $file = File::load($fid);
    }
    return $file;
  }
203149
protected function getMorphs($name, $type, $id)
    {
        $type = $type ?: $name.'_type';

        $id = $this->getkeyname();

        return array($type, $id);
    }
141140
public function getConfiguredBuilder(Table $table, $type, $cache = true)
    {
        $classname = $this->getBuilderClassname($type);
        $builder = new $classname($table);
        $builder->setGeneratorConfig($this);

        return $builder;
    }
614875
public function getCurrentDcMultilingualLanguage(string $table, int $id)
    {
        $translatableLangs = $this->getDcMultilingualTranslatableLanguages($table);

        /** @var SessionInterface $objSessionBag */
        $objSessionBag = $this->container->get('session')->getBag('contao_backend');
        $sessionKey = 'dc_multilingual:'.$table.':'.$id;

        /** @var Request $request */
        $request = $this->container->get('request_stack')->getCurrentRequest();

        if ('tl_language' === $request->request->get('FORM_SUBMIT')) {
            $language = $request->request->get('language');
        } elseif ($objSessionBag->has($sessionKey)) {
            $language = $objSessionBag->get($sessionKey);
        }

        if (\in_array($language, $translatableLangs)) {
            return $language;
        }

        return false;
    }
1248943
public function dbItem($table, $id, $key = 'id')
    {
        $result = Eresus_CMS::getLegacyKernel()->db->selectItem($this->__table($table),
            "`$key` = '$id'");

        return $result;
    }
1276105
public static function get_instance($id, $type) {

        switch ($type) {
            case 'site':
            case 'course':
            case 'module':
                return new blog_filter_context($id, $type);
                break;

            case 'group':
            case 'user':
                return new blog_filter_user($id, $type);
                break;

            case 'tag':
                return new blog_filter_tag($id);
                break;

            default:
                $classname = "blog_filter_$type";
                if (class_exists($classname)) {
                    return new $classname($id, $type);
                }
        }
    }