Does not work correctly with Laravel

Hello all,

I followed the tutorial at [url]http://www.dhtmlx.com/blog/using-dhtmlxgantt-with-laravel/[/url] exactly. In the end there where no errors, the Gantt loaded, but it was completely empty. Manually accessing ‘/gantt_data’ gave me an empty data set:


However, when I use the example project from [url]http://www.dhtmlx.com/x/download/regular/dhtmlxConnector/laravel_dhtmlx.zip[/url] as is, I do get a filled data set and the Gantt is filled accordingly. When I run ‘composer update’ in this project however, the data set is empty again.

This is the result of running ‘composer update’ in the example project:

vagrant@homestead:~/code/planning$ composer update
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing symfony/filesystem (v2.7.1)
  - Removing symfony/var-dumper (v2.7.1)
  - Installing symfony/var-dumper (v2.7.9)
    Downloading: 100%

  - Removing symfony/translation (v2.7.1)
  - Installing symfony/translation (v2.7.9)
    Downloading: 100%

  - Removing symfony/routing (v2.7.1)
  - Installing symfony/routing (v2.7.9)
    Downloading: 100%

  - Removing symfony/process (v2.7.1)
  - Installing symfony/process (v2.7.9)
    Downloading: Connecting...
Could not fetch https://api.github.com/repos/symfony/process/zipball/0570b9ca51135ee7da0f19239eaf7b07ffb87034, please create a GitHub OAuth token to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+homestead+2016-02-05+0831
to retrieve a token. It will be stored in "/home/vagrant/.config/composer/auth.json" for future use by Composer.
Token (hidden):
Token stored successfully.
    Downloading: 100%

  - Removing symfony/http-foundation (v2.7.1)
  - Installing symfony/http-foundation (v2.7.9)
    Downloading: 100%

  - Removing symfony/event-dispatcher (v2.7.1)
  - Installing symfony/event-dispatcher (v2.8.2)
    Downloading: 100%

  - Removing symfony/debug (v2.7.1)
  - Installing symfony/debug (v2.7.9)
    Downloading: 100%

  - Removing symfony/http-kernel (v2.7.1)
  - Installing symfony/http-kernel (v2.7.9)
    Downloading: 100%

  - Removing symfony/finder (v2.7.1)
  - Installing symfony/finder (v2.7.9)
    Downloading: 100%

  - Removing symfony/dom-crawler (v2.7.1)
  - Installing symfony/dom-crawler (v2.7.9)
    Downloading: 100%

  - Removing symfony/css-selector (v2.7.1)
  - Installing symfony/css-selector (v2.7.9)
    Downloading: 100%

  - Removing symfony/console (v2.7.1)
  - Installing symfony/console (v2.7.9)
    Downloading: 100%

  - Removing nikic/php-parser (v1.3.0)
  - Installing nikic/php-parser (v2.0.0)
    Downloading: 100%

  - Removing psy/psysh (v0.4.4)
  - Installing psy/psysh (v0.6.1)
    Downloading: 100%

  - Installing paragonie/random_compat (1.1.6)
    Downloading: 100%

  - Removing nesbot/carbon (1.19.0)
  - Installing nesbot/carbon (1.21.0)
    Downloading: 100%

  - Removing mtdowling/cron-expression (v1.0.4)
  - Installing mtdowling/cron-expression (v1.1.0)
    Downloading: 100%

  - Removing monolog/monolog (1.13.1)
  - Installing monolog/monolog (1.17.2)
    Downloading: 100%

  - Removing league/flysystem (1.0.4)
  - Installing league/flysystem (1.0.16)
    Downloading: 100%

  - Installing symfony/polyfill-util (v1.1.0)
    Downloading: 100%

  - Installing symfony/polyfill-php56 (v1.1.0)
    Downloading: 100%

  - Removing jeremeamia/superclosure (2.1.0)
  - Installing jeremeamia/superclosure (2.2.0)
    Downloading: 100%

  - Removing doctrine/inflector (v1.0.1)
  - Installing doctrine/inflector (v1.1.0)
    Loading from cache

  - Removing danielstjules/stringy (1.9.0)
  - Installing danielstjules/stringy (1.10.0)
    Downloading: 100%

  - Removing classpreloader/classpreloader (1.4.0)
  - Installing classpreloader/classpreloader (3.0.0)
    Downloading: 100%

  - Removing laravel/framework (v5.1.2)
  - Installing laravel/framework (v5.1.29)
    Downloading: 100%

  - Removing symfony/yaml (v2.7.1)
  - Installing symfony/yaml (v3.0.2)
    Downloading: 100%

  - Removing sebastian/recursion-context (1.0.0)
  - Installing sebastian/recursion-context (1.0.2)
    Downloading: 100%

  - Removing sebastian/exporter (1.2.0)
  - Installing sebastian/exporter (1.2.1)
    Downloading: 100%

  - Removing sebastian/diff (1.3.0)
  - Installing sebastian/diff (1.4.1)
    Downloading: 100%

  - Removing sebastian/comparator (1.1.1)
  - Installing sebastian/comparator (1.2.0)
    Downloading: 100%

  - Removing phpspec/prophecy (v1.4.1)
  - Installing phpspec/prophecy (v1.5.0)
    Downloading: 100%

  - Removing phpspec/phpspec (2.2.1)
  - Installing phpspec/phpspec (2.4.1)
    Downloading: 100%

  - Removing sebastian/version (1.0.5)
  - Installing sebastian/version (1.0.6)
    Downloading: 100%

  - Removing sebastian/global-state (1.0.0)
  - Installing sebastian/global-state (1.1.1)
    Downloading: 100%

  - Removing sebastian/environment (1.2.2)
  - Installing sebastian/environment (1.3.3)
    Downloading: 100%

  - Removing phpunit/php-text-template (1.2.0)
  - Installing phpunit/php-text-template (1.2.1)
    Downloading: 100%

  - Removing phpunit/phpunit-mock-objects (2.3.4)
  - Installing phpunit/phpunit-mock-objects (2.3.8)
    Downloading: 100%

  - Removing phpunit/php-timer (1.0.6)
  - Installing phpunit/php-timer (1.0.7)
    Downloading: 100%

  - Removing phpunit/php-token-stream (1.4.2)
  - Installing phpunit/php-token-stream (1.4.8)
    Downloading: 100%

  - Removing phpunit/php-file-iterator (1.4.0)
  - Installing phpunit/php-file-iterator (1.4.1)
    Downloading: 100%

  - Removing phpunit/php-code-coverage (2.1.5)
  - Installing phpunit/php-code-coverage (2.2.4)
    Downloading: 100%

  - Removing phpunit/phpunit (4.7.3)
  - Installing phpunit/phpunit (4.8.22)
    Downloading: 100%

  - Removing dhtmlx/connector-php (dev-modern bf05131)
  - Installing dhtmlx/connector-php (dev-modern e5b1de8)
    Downloading: 100%

paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
Writing lock file
Generating autoload files
> php artisan clear-compiled
> php artisan optimize
Generating optimized class loader

It seems to me that the most recent packages of Laravel and Dhtmlx don’t work well together.

Any ideas?

I am facing the same issue. It only work if you add GanttTask::where() in your controller.

Currently it does now show all code.

In order to show all task.
in your laravel project directory, go to vendor>dhtmlx>connector-php>codebase>Dhtmlx>conecctor>DataStorage>PHPLaravelDBDataWrapper.php

try comment this code line 12 & 13(if you use sublime text editor) and save it. And run again. You should see all.

else if ($sourceData && method_exists($sourceData, "toArray")) $res = $sourceData->toArray();

Hi,

You can update dhtmlx/connector-php package to version 3.0.3, it will resolve the issue.