public function persist(QuerySet $queries, $entity)
{
$attribute = $this->getMappingAttribute();
$key = $this->mapping['fieldname'];
$qb =& $queries[0];
$valueMethod = 'serialize' . ucfirst($this->camelize($attribute));
$value = $entity->{$valueMethod}();
if ($this instanceof SanitiserAwareInterface && is_string($value)) {
$isWysiwyg = $this instanceof WysiwygAwareInterface;
$value = $this->getSanitiser()->sanitise($value, $isWysiwyg);
}
$type = $this->getStorageType();
if (null !== $value) {
$value = $type->convertToDatabaseValue($value, $this->getPlatform());
} elseif (isset($this->mapping['default'])) {
$value = $this->mapping['default'];
}
$qb->setValue($key, ':' . $key);
$qb->set($key, ':' . $key);
$qb->setParameter($key, $value);
}