/** * Loop through all passed properties and update the associations * * @param array $properties * @param AssociationMetadataCollection $collection * @param object $resource */ protected function updateEntityAssociations(array $properties, AssociationMetadataCollection $collection, $resource) { $entityMetadata = $this->getEntityMetadata($resource); foreach ($properties as $propertyName => $propertyValue) { if ($collection->has($propertyName)) { $this->updateEntityAssociation($propertyName, $propertyValue, $resource, $entityMetadata); } } }
/** * Checks whether the association is serializable * * @param string $associationName * @param AssociationMetadataCollection $collection * * @return bool */ protected function isAssociationSerializable($associationName, AssociationMetadataCollection $collection) { if ($collection->has($associationName)) { $association = $collection->get($associationName); return $association->hasGroup($this->context['group']) || $association->hasDefaultGroup(); } return false; }