Skip to content

HasOneSql::addField(): Use type from reference Model#880

Merged
mvorisek merged 4 commits intoatk4:developfrom
PhilippGrashoff:feature/hasOneUseTypeFromReferenceModel
Jul 12, 2021
Merged

HasOneSql::addField(): Use type from reference Model#880
mvorisek merged 4 commits intoatk4:developfrom
PhilippGrashoff:feature/hasOneUseTypeFromReferenceModel

Conversation

@PhilippGrashoff
Copy link
Copy Markdown
Contributor

Hello,

currently, the type of a field is not taken from the referenced model (unlike Caption, this is already pulled from the referenced Model). This leads to:

//in ModelA
$this->addField('some_date', ['type' => 'date']);

//in ModelB
$this->hasOne('model_a_id', ['model' => [ModelA::class]]);
$this->getRef('model_a_id')->addField('some_date');

at this point, ModelBs field 'some_date' is of type string, not of type date as defined in ModelA. This PR would change this.

@PhilippGrashoff PhilippGrashoff force-pushed the feature/hasOneUseTypeFromReferenceModel branch from 97e1c8d to 1363857 Compare May 28, 2021 14:23
@PhilippGrashoff
Copy link
Copy Markdown
Contributor Author

RTM, can't assign labels

@PhilippGrashoff PhilippGrashoff marked this pull request as ready for review July 12, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants