graphaware/neo4j-php-ogm

relationship collection without mapped by attribute

Opened this issue · 0 comments

Actually in a simple relationship, if the property is an object, we don't need to create the mirror attribute in the target class.

  • Set this property and flush the object result in the creation of a new relation in the database.
  • Set null and flush delete the relation the database (if exist).

If we don't create the mirror property on the target entity class B and we don't set the mappedBy attribut, we can still add items to the collection, but the deletions won't be forwarded to the database because the uow won't take them in the managed relationship references.

Sometimes create the mirror property is not interesting and pollute the code whit many additional lines. If you don't add this property, add property is possible (because the LazyCollection historic the added properties) but try to remove an element it will don't work because the property is not managed by the UoW.

it would be great if the remove action was supported in case the mappedBy attribute is not set and the mirror property is not created.