Bidirectional One-To-One Relationships in Flow


Is it possible to have <strong>One-To-One Relationships</strong> in Flow without having to <strong>set the attributes twice</strong>?

I have two tables that are connected in a One-To-One Relationship, but only one of them should contain an extra column for this Relation.

Doctrine clearly supports this behavior: <a href="http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html#one-to-one-bidirectional" rel="nofollow">http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html#one-to-one-bidirectional</a>

The class that should come with a componenttape column:

/** * @Flow\Entity */ class Component{ /** * @var \Some\Package\Domain\Model\Component\Tape * @ORM\OneToOne(cascade={"all"}, inversedBy="component") */ protected $componentTape; … }

The class that should just be able to find the connection without an extra column:

/** * @Flow\Entity */ class Tape{ /** * @var \ Some\Package\Domain\Model\Component * @ORM\OneToOne(mappedBy="componentTape") */ protected $component; }

A doctrine update will create extra columns for both models.

This is what my workarround at the moment looks like:

class Component{ .. /** * @param \Some\Package\Domain\Model\Component\Tape $componentTape * @return void */ public function setComponentTape($componentTape) { $this->componentTape = $componentTape; $this->componentTape->setComponent($this); }


The workaround will be necessary anyway to keep the relation correct at all times during a request. But the second DB column shouldn't be necessary. Did you check if doctrine actually fills it? Maybe/Probably just the created migration is wrong and the component column in Tape can be omitted.


Does your workaround stil work for you? In my case, I have to update the ComponentTape model on the repository by self:

class Component { /** * @param \Some\Package\Domain\Model\Component\Tape $componentTape * @return void */ public function setComponentTape($componentTape) { $this->componentTape = $componentTape; $this->componentTape->setComponent($this); $this->componentTapeRepository->update($this->componentTape); }


  • Spring Data JPA - bidirectional relation with infinite recursion
  • The binary operator LessThan is not defined for the types 'System.Nullable`1[System.DateTime]&#
  • JSP trimSpaces directive not working!
  • Internalisation using Spring Security In-Memory Authentication
  • Rest API - NullPointerException in Broadleaf Commerce
  • How do I programmatically configure Jersey to use Jackson for JSON (de)serialization?
  • NHibernate: many-to-one and lazy
  • Servlet class com.foobar.jaxrs.application.MyApplication is not a javax.servlet.Servlet
  • Subsetting Data Frame into Multiple Data Frames in Pandas
  • Read File Content Line by Line from byte[] in Groovy
  • How to emulate integrated numeric keypad cursor keys in linux
  • Is it possible to collect a stream to two different collections using one line?
  • Can I put a + sign in a folder with IIS?
  • Doctrine2 inverse persistance not working in nested forms
  • c++ regex_replace not doing intended substitution
  • Doctrine/Symfony entity generator and generating entity from one table
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • How to get links to open in the native browser in iOS Meteor apps?
  • Why cepheus don't send int without quotes to orion?
  • GAE: Way to get reference to an HttpSession from its ID?
  • Implicit joins and Where in Doctrine - how?
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • Scala multiline string placeholder
  • What is the purpose of TaskExecutor in spring?
  • Force show.bind execution
  • gspread or such: help me get cell coordinates (not value)
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • How to delay loading a property with linq to sql external mapping?
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to get icons for entities from eclipse?
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • Trying to get generic when generic is not available
  • Java static initializers and reflection
  • unknown Exception android
  • JaxB to read class hierarchy
  • Observable and ngFor in Angular 2
  • Unable to use reactive element in my shiny app