Coder Social home page Coder Social logo

Comments (7)

MichaelKling avatar MichaelKling commented on July 23, 2024

You could call the all function with a filter searching for the specific project id (there are lot of undocumented features in the api - its worth a try).

from php-redmine-api.

JanMalte avatar JanMalte commented on July 23, 2024

I can confirm this issue. But you can't rely only on the name, as it can be the same for multiple projects. Only the identifier and the ID of a Redmine project are unique.

from php-redmine-api.

Henry31 avatar Henry31 commented on July 23, 2024

we have the same issue here, too!

from php-redmine-api.

Henry31 avatar Henry31 commented on July 23, 2024

As a workaround i check the output against my limit.

if ($project['total_count'][0] >= $project_limit) {
  //warning
}

from php-redmine-api.

ferdynator avatar ferdynator commented on July 23, 2024

I've changed the AbstractApi::retrieveAll method to work around this:

protected function retrieveAll($endpoint, array $params = array())
{
    $defaults = array(
        'limit' => 100,
        'offset' => 0,
    );
    $params = $this->sanitizeParams($defaults, $params);

    $ret = array();

    $limit = $params['limit'];
    $offset = $params['offset'];
    $totalCount = 101;

    while ($offset < $totalCount) {

        $newDataSet = (array) $this->get($endpoint.'?'.http_build_query($params));
        $ret = array_merge_recursive($ret, $newDataSet);

        if (empty($newDataSet) || !isset($newDataSet['limit']) || !isset($newDataSet['total_count'])) {
            $totalCount = 0;
        } else {
            $totalCount = $newDataSet['total_count'];
            $offset += $limit;
            $params['offset'] = $offset;
        }
    }

    return $ret;
}

This solves the issue but many tests fail. Can anyone confirm my solution? If it works for you I will update the tests correctly and create a PR

from php-redmine-api.

kbsali avatar kbsali commented on July 23, 2024

@VoidAndAny, it's been a loooong time since you raised this issue... see @ferdynator 's last comment, should this still be needful to you!

from php-redmine-api.

Detzler avatar Detzler commented on July 23, 2024

retrieveAll says: "Retrieves all the elements of a given endpoint (even if the total number of elements is greater than 100)."

It doesn't do what it should. Please fix

from php-redmine-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.