// Add the model to the updated collection to have an flag which models updated.
$updated->
add($attribute);
} // After all passed data items added to the internal collection, we have to iterate the items
// to remove all old items which are not updated.
foreach ($this->
$getterFunction() as $attr) { // The updated collection contains all updated and created models.
if (!
$updated->
contains($attr)) { $this->
$getterFunction()->
removeElement($attr);
} } return $this;
} /**
* Helper function to set the association data of a ORM\ManyToOne association of doctrine.
* <br><br>
* The <b>$data</b> parameter contains the data for the collection property. It can contains an array of
* models or data arrays. If the $data parameter is set to null the associated collection will cleared.
* <br><br>
* The <b>$model</b> parameter expects the full name of the associated model.
* For example:
* <ul>
* <li>We are in the Article model in the setSupplier() function.</li>
* <li>Here we want to set the Supplier objects over the "setManyToOne" function</li>
* <li>So we passed as $model parameter: <b>"\Shopware\Models\Article\Supplier"</b></li>
* </ul>
* <br>
* The <b>$property</b> parameter expect the name of the association property.
* For example:
* <ul>
* <li>In the setSupplier() function of the article model we would expects <b>"supplier"</b>.</li>
* </ul>
*
* @param ModelEntity|array|null $data Model data, example: an data array or an instance of the model
* @param string $model Full namespace of the association model, example: '\Shopware\Models\Article\Supplier'
* @param string $property Name of the association property, example: 'supplier'
*
* @throws InvalidArgumentException
*
* @return $this
*/