Closed Insolita closed 6 years ago
Ok I was able to reproduce the issue in tests. It happens when using a custom foreign key as object property. As a workaround until it's fixed, using "filter_task_id" as foreign key should work.
I admit that I could incorrectly configure the properties of entity Map as there is not enough documentation I can`t change schema and field names; it is active app with legacy code and i must refactor it piece by piece,
Your configuration is correct, It's definetely a bug, I'll fix it as soon as I can.
I'm aware of the documentation is clearly outdated and rewriting it is on my top priority list..
Thanks for quick response, and good project!
@Insolita I pushed a fix, can you tell me if it solves your issue ?
@RemiCollin , yes, thanks, new release solved my issue ... but I have new issue with embedded objects...
I add in FilterTaskMap
public function stage(FilterTask $task)
{
return $this->embedsOne($task, WorkStage::class, 'stage')
->setPrefix('')->setColumnMap(['value'=>'stage']);
}
And got fails when try test wth storing (test with finding passed successfull and this embed was resolved)
WorkStage is simple stdClass ValueObject (Also WorkStageMap exists, and test wtih finidng was passed)
I'll take a more detailed research a bit later
Okay, just open a new issue then ;)
I'll close this one
So i have pure entities without magic, and try test
With user relation all right, but with candidates relations test failed; I make debug of this case, and see, that before https://github.com/analogueorm/analogue/blob/b91fd2417dc642d3c9d8c7c262061e69ba2f513b/src/Commands/Store.php#L147 candidate records was stored in database with correct foreighn keys ('report_id'); but after checking dirty attributes it detect 'report_id' as dirty, and next steps override it to null https://github.com/analogueorm/analogue/blob/b91fd2417dc642d3c9d8c7c262061e69ba2f513b/src/Commands/Store.php#L52 https://github.com/analogueorm/analogue/blob/b91fd2417dc642d3c9d8c7c262061e69ba2f513b/src/Commands/Store.php#L266
Entity and Map examples