You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could be missing something but if interested, feel free to turn into an issue and I can create a PR.
Originally posted by alexander-schranz June 13, 2023
This is currently also related if we use the same classes maybe in a future Object Data Mapper package or not. As it could also be:
At current state that is not supported and currently avoding that to avoid to have complexity in the mapping of the stored data vs presentated data, but the initial interface was created by keep that in mind and that is way it currently looks like this.
I think it should not hurt the performance too much if we currently add support for int as field key but make sure that $index->fields always use the name as that is required to access the field. So we could adopt the __construct of Index do something like this:
$normalizedFields = [];
foreach ($fieldsas$key => $field) {
if (is_int($key)) {
$key = $field->name;
}
$this->normalizedFields[$key] = $field;
}
$this->fields = $normalizedFields; // set to the readonly publi
This needs also keep in mind for TypedField and ObjectField which also have fields configuration. If you want to give it a try feel free to create a pull request for it.
To avoid errors at current state we will add validation in #427. To avoid errors for false keys at current state. Still in future a mapping may be possible.
alexander-schranz
changed the title
Index fields name configuration duplication
[Core] Index fields name configuration duplication
Oct 6, 2024
Discussed in #199 @kbond
Originally posted by kbond June 13, 2023
This is a very tiny papercut I had - not a big deal.
Consider this:
I think it would be nice if we didn't have to set the array key:
I could be missing something but if interested, feel free to turn into an issue and I can create a PR.
Originally posted by alexander-schranz June 13, 2023
This is currently also related if we use the same classes maybe in a future Object Data Mapper package or not. As it could also be:
The key is currently required inside
Index.php
class as the items are currently accessed that way.In a ODM the above example could maybe look like this:
What I'm not yet sure if I should support something like doctrine does
fieldName
vscolumnName
which would be something like this:At current state that is not supported and currently avoding that to avoid to have complexity in the mapping of the stored data vs presentated data, but the initial interface was created by keep that in mind and that is way it currently looks like this.
I think it should not hurt the performance too much if we currently add support for
int
as field key but make sure that$index->fields
always use the name as that is required to access the field. So we could adopt the__construct
ofIndex
do something like this:This needs also keep in mind for
TypedField
andObjectField
which also havefields
configuration. If you want to give it a try feel free to create a pull request for it.This issue is related to #107
The text was updated successfully, but these errors were encountered: