Kimai2: Upgrade from v1 fails with v1.8 due to undefined method setHourlyRate

Created on 4 Mar 2020  路  13Comments  路  Source: kevinpapst/kimai2

I've installed kimai2 v1.8 and tried to import the data from v1 with bin/console kimai:import-v1. The importer fails with the following message: Attempted to call an undefined method named "setHourlyRate" of class "App\Entity\Activity".

More details from the log file:

[object] (Error(code: 0): Call to undefined method App\\Entity\\Activity::setHourlyRate()
at /var/www/kimai_v2/src/Command/KimaiImporterCommand.php:902)","command":"kimai:import-v1 --language=de 'mysql://[...]:[...]@[...]:3306/kimai'  [...]","message":"Call to undefined method App\\Entity\\Activity::setHourlyRate()"} []

The method setHourlyRate was removed from entity Activity with #1455, but it seems, that the importer has not been adjusted.

bug

All 13 comments

Hah, thanks for the heads up, I'll have a look asap

It would be awesome if you could test the PR #1521 and provide some feedback.
I haven't tested it yet, as I need to find a database backup first...

The import is working fine with PR #1521 :-) Thank you!

While the fix itself seems to work in the first place, I am currently greeted with the following error:

In Project.php line 150:
  Argument 1 passed to App\Entity\Project::setCustomer() must be an instance of App\Entity\Customer, null given, called in /var/www/kimai/src/
  Command/KimaiImporterCommand.php on line 750

Tried some pretty basic debugging directly on the remote server, but as soon as I touch anything I end up with a OOM error...
Is there anyone facing the same error or has an idea about it? Was using HEAD for this.

I guess you are using the latest master?
Please add this to line 747: https://github.com/kevinpapst/kimai2/blob/master/src/Command/KimaiImporterCommand.php#L747

if (null === $oldProject) {
var_dump($oldProject);
var_dump(array_keys($this->customers));
exit;
}

I don't think it has to do with this PR at all. Kimai 1 was not very strong when it comes to data integrity (no foreign key support). So you may have a project in the database, whose customer was deleted. We need to find out

Well, not only a blazing fast answer but also dead on target - thank you very much! :)
I did not even consider that, as I was assuming foreign key constraints...
Fixed the broken relation and the import now seems to work flawlessly. However, after the import I'm just getting an internal server error. :P
So I guess I will have to look into that next!

check var/log/prod.log - with a bit of luck we find an answer there

Thanks again! :)

As nothing was written there since performing the import, I checked the rights and ownership of the var/* folders.
Seems like bits of the folder structure got created during the import and as I wasn't executing them as the user the process runs on, it failed to create var/cache/prod/translations...

Now let's see if I can adapt to the new version of a tool I am using for more years than I can think of. :)
Thanks for all your time spent in developing this great piece of software!

LOL, yes. Kimai 1 was more then 10 years old ;-)

I appreciate any feedback! Open new issues for stuff that you can't get just to.

LOL, yes. Kimai 1 was more then 10 years old ;-)

Just checked, the oldest entries to the timesheet are from 2012 and I am pretty sure I cleaned out the database instead of updating back then! :D

Almost as long as myself. Nice! My oldest is from 14.04.2011.
Can't remember seeing you in the issue tracker. I hope the new version works for you as well as the old did.

Can't remember seeing you in the issue tracker. I hope the new version works for you as well as the old did.

Most probably because it "just worked" and I never had any mayor issue that I had to reach out for. ;)
After all, I like where this all went - keep it up!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miketubby picture miketubby  路  6Comments

heeen picture heeen  路  6Comments

Recoil1980 picture Recoil1980  路  5Comments

trentks picture trentks  路  5Comments

Recoil1980 picture Recoil1980  路  7Comments