Extracts the database name of a mongo db connection string.

If no database is specified in the connection string, the default
value {@link defaultDatabaseName} is returned.

@param  mixed $value

@return string
540849
public function filter($value)
    {
        // extract database
        $dbName = preg_match('~^mongodb://[^/]+/([^\?]+)~', $value, $match)
            ? $match[1]
            : $this->getDefaultDatabaseName();

        return $dbName;
    }
95847
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (empty($value)) {
            return null;
        }

        if ($value instanceof UuidInterface) {
            return $this->encode($value);
        }

        try {
            if (is_string($value) || method_exists($value, '__toString')) {
                $uuid = $this->getUuidFactory()->fromString((string) $value);

                return $this->encode($uuid);
            }
        } catch (InvalidArgumentException $e) {
            // Ignore the exception and pass through.
        }

        throw ConversionException::conversionFailed($value, self::NAME);
    }
487226
private function getDbName() {
        if (!isset($this->dbname)) {
            $this->dbname = $this->getPDO()->query('select database()')->fetchColumn();
        }
        return $this->dbname;
    }
734973
public function convertToDatabaseValue($value, $marshal = true)
    {
        $dbValue = $this->databaseValue($value);

        if (!$marshal) {
            return $dbValue;
        }

        $setTypeKey = null;
        foreach ($dbValue as $key => $value) {
            if (!in_array($key, self::$allowedTypes)) {
                throw ODMException::setsCanOnlyHoldScalars();
            }

            if ($setTypeKey === null) {
                $setTypeKey = $key;
            } elseif ($setTypeKey !== $key) {
                throw ODMException::setsMustBeUniform();
            }
        }

        return $value === null ? self::getNull() : [$setTypeKey . 'S' => $dbValue];
    }
456976
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (empty($value)) {
            return null;
        }

        if ($value instanceof UuidInterface) {
            return $value->getBytes();
        }

        try {
            if (is_string($value) || method_exists($value, '__toString')) {
                return Uuid::fromString((string) $value)->getBytes();
            }
        } catch (InvalidArgumentException $e) {
            // Ignore the exception and pass through.
        }

        throw ConversionException::conversionFailed($value, static::NAME);
    }
859613
public function convertToDatabaseValueSql($value, AbstractPlatform $platform)
    {
        return parent::convertToDatabaseValueSQL($value instanceof ModelInterface ? $value->pk : $value, $platform);
    }
488491
protected function _query($value) 
    { 
        /**
         * Check for an adapter being defined. if not, fetch the default adapter.
         */ 
        if($this->_adapter === null) {
            $this->_adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
        }

        /**
         * Build select object
         */ 
        $select = new Zend_Db_Select($this->_adapter);
        $select->from($this->_table)
               ->columns($this->_field)
               ->where($this->_adapter->quoteIdentifier($this->_field).' = ?', $value); 
        if ($this->_exclude !== null) { 
            if (is_array($this->_exclude)) { 
                $select->where($this->_adapter->quoteIdentifier($this->_exclude['field']).' != ?', $this->_exclude['value']); 
            } else { 
                $select->where($this->_exclude); 
            } 
        } 
        $select->limit(1); 
                 
        /**
         * Run query
         */ 
        $result = $this->_adapter->fetchRow($select, array(), Zend_Db::FETCH_ASSOC); 
         
        return $result; 
    }
976542
public function extract($value)
    {
        if (is_null($value)) {
            return $value;
        }

        $entityValues = $this->getHydratorForEntity($value)->extract($value);
        $entityMetadata = $this->getMetadataMap()[ClassUtils::getRealClass(get_class($value))];

        $link = new Link('self');
        $link->setRoute($entityMetadata['route_name']);
        $link->setRouteParams([
            $entityMetadata['route_identifier_name'] => $entityValues[$entityMetadata['entity_identifier_name']]
        ]);

        $linkCollection = new LinkCollection();
        $linkCollection->add($link);

        $halEntity = new HalEntity(new stdClass());
        $halEntity->setLinks($linkCollection);

        return $halEntity;
    }
1131035
protected function databaseValue($value)
    {
        if (!$value instanceof \DateTime) {
            throw ODMException::conversionFailedInvalidType($value, Type::DATE, ['null', 'DateTime']);
        }

        $this->setToMidnight($value);

        return (string)$value->getTimestamp();
    }
148225
protected function getValueDescription($value)
    {
        switch (true) {
            case (is_numeric($value)):
                $value = strval($value);
                break;

            case (is_bool($value) && $value):
                $value = '(boolean) true';
                break;

            case (is_bool($value) && !$value):
                $value = '(boolean) false';
                break;

            case (is_null($value)):
                $value = 'null value';
                break;

            default:
                break;
        }

        return $value;
    }
997964
protected function getTypeOf($value): string
    {
        $type = gettype($value);

        switch ($type) {
            case 'integer':
            case 'boolean':
            case 'string':
                return $type;
            case 'double':
                return 'float';
            case 'array':
                return count(array_filter(array_keys($value), 'is_string')) > 0 ? 'assoc' : 'array';
            case 'object':
                return $value instanceof Traversable ? 'array' :
                    ($value instanceof DateTime ? DateTime::class : 'object');
            default:
                return $type;
        }
    }
720928
def dbname(self, value):
        
        self._dbname = value
        self._connectionXML.set('dbname', value)
692477
protected function extractDefault($defaultValue)
	{
		if($this->dbType==='timestamp' )
			$this->defaultValue=null;
		else
			parent::extractDefault(str_replace(array('(',')',"'"), '', $defaultValue));
	}
791410
public static function convertToDb($value)
    {
        return $value instanceof ExtReference ?
            \MongoDBRef::create($value->getRef(), $value->getId()) :
            null;
    }
1276005
protected function query($value)
    {
        /** @var EntityManagerInterface $objectManager */
        $objectManager = $this->getOption('object_manager');
        /** @var string $targetClass */
        $targetClass = $this->getOption('target_class');

        /** @var \PServerCore\Entity\Repository\User $repo */
        $repo = $objectManager->getRepository($targetClass);

        return $repo->isUserValid4UserName($value);
    }
1133958
public function extract($value)
    {
        if ($this->nullable && $value === null) {
            return null;
        }
        
        return new MongoBinData($value, $this->type);
    }
214494
public static function convertToDb($value)
    {
        if (!is_array($value)) {
            return [];
        }

        // see DateType::convertToDatabaseValue()
        $convertor = function ($value) {
            if ($value === null || $value instanceof \MongoDate) {
                return $value;
            }

            try {
                $datetime = DateType::getDateTime($value);
                return new \MongoDate($datetime->format('U'), $datetime->format('u'));
            } catch (\InvalidArgumentException $e) {
                return null;
            }
        };

        return array_values(array_filter(array_map($convertor, $value)));
    }