Replies: 1 comment
-
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: use Schranz\Search\SEAL\Schema\Field;
use Schranz\Search\SEAL\Schema\Index;
return new Index('page', [
'id' => new Field\IdentifierField(),
'title' => new Field\TextField(),
'subtitle1' => new Field\TextField(),
'subtitle2' => new Field\TextField(),
'description' => new Field\TextField(),
]); The key is currently required inside In a ODM the above example could maybe look like this: #[Index('page')]
class Test {
#[Field\IdentifierField()]
public string $id;
} What I'm not yet sure if I should support something like doctrine does return new Index('page', [
'fieldName' => new Field\TextField('columnName'),
]); 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 $normalizedFields = [];
foreach ($fields as $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 |
Beta Was this translation helpful? Give feedback.
-
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.
Beta Was this translation helpful? Give feedback.
All reactions