File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1616use Mango \Bundle \JsonApiBundle \Configuration \Relationship ;
1717use Mango \Bundle \JsonApiBundle \Configuration \Resource ;
1818use Metadata \MergeableClassMetadata ;
19+ use Metadata \MergeableInterface ;
1920
2021/**
2122 * @author Steffen Brem <steffenbrem@gmail.com>
@@ -104,6 +105,25 @@ public function addRelationship($relationship)
104105 $ this ->relationships ->add ($ relationship );
105106 }
106107
108+ /**
109+ * {@inheritDoc}
110+ */
111+ public function merge (MergeableInterface $ object )
112+ {
113+ if (!$ object instanceof self) {
114+ throw new \InvalidArgumentException (sprintf ('Object must be an instance of %s. ' , __CLASS__ ));
115+ }
116+
117+ parent ::merge ($ object );
118+
119+ $ this ->resource = $ object ->getResource ();
120+ $ this ->idField = $ object ->getIdField ();
121+
122+ foreach ($ object ->getRelationships () as $ relationship ) {
123+ $ this ->addRelationship ($ relationship );
124+ }
125+ }
126+
107127 /**
108128 * {@inheritdoc}
109129 */
You can’t perform that action at this time.
0 commit comments