Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Dealing with schema-less properties #157

Open
davidhiendl opened this issue Oct 13, 2017 · 4 comments
Open

Dealing with schema-less properties #157

davidhiendl opened this issue Oct 13, 2017 · 4 comments

Comments

@davidhiendl
Copy link

davidhiendl commented Oct 13, 2017

The documentation contains no mention on how to deal with schema-less properties (eg. not mapped to a class field). It would be helpful to be able to access un-mapped properties by key with generic getters & setters.

Currently I have no idea how to realize this even after browsing the source code. The only way I could think of doing this efficiently is creating a custom / modified proxy-factory implementation.

Or did I miss something?

@ikwattro
Copy link
Member

What is the purpose of having a need to access properties from the db if they are not mapped as class fields ?

@davidhiendl
Copy link
Author

Sometimes you might not know all properties ahead of time or they might be dynamic, yes you can represent that with relations and more often that not that is the better approach. But sometimes it is not or will yield many 1-value nodes (which is undesirable since they are not their own "thing").

My current use case is where this might be an issue is processing user-data. The properties are not all known ahead of time (nor should they be). I could have 1 node per entity with property access or 1+N (property count) nodes which would increase the amount of nodes (for my small sample data set) from 100,000 to 2,000,000.

@ikwattro
Copy link
Member

I see, we would need to add a specific annotation for that for first being able to retrieve them. Am not sure yet that changes to those properties should be mapped against the db during the flush events.

@davidhiendl
Copy link
Author

I think it would be reasonable to mirror the Java OGM's behavior which maps any properties starting with a "prefix_" to a map. I believe it also does respect changes to this map.

If you point me in the right direction where this should be implemented I'd willing to work on this as I'm moving forward with my project and decided to use the PHP OGM.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants