eZ\Publish\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway\LegacyStorage::getReferencedFiles PHP Method

getReferencedFiles() public method

Returns a set o file references, referenced by the given $fieldIds.
public getReferencedFiles ( array $fieldIds, $versionNo ) : array
$fieldIds array
return array
    public function getReferencedFiles(array $fieldIds, $versionNo)
    {
        if (empty($fieldIds)) {
            return array();
        }
        $connection = $this->getConnection();
        $selectQuery = $connection->createSelectQuery();
        $selectQuery->select($connection->quoteColumn('filename'), $connection->quoteColumn('mime_type'))->from($connection->quoteTable($this->getStorageTable()))->where($selectQuery->expr->lAnd($selectQuery->expr->in($connection->quoteColumn('contentobject_attribute_id'), $fieldIds), $selectQuery->expr->eq($connection->quoteColumn('version'), $selectQuery->bindValue($versionNo, null, \PDO::PARAM_INT))));
        $statement = $selectQuery->prepare();
        $statement->execute();
        $gateway = $this;
        return array_map(function ($row) use($gateway) {
            return $gateway->prependMimeToPath($row['filename'], $row['mime_type']);
        }, $statement->fetchAll(\PDO::FETCH_ASSOC));
    }