Pagekit\Database\ORM\MetadataManager::getConnection PHP Méthode

getConnection() public méthode

Gets the database connection.
public getConnection ( ) : Pagekit\Database\Connection
Résultat Pagekit\Database\Connection
    public function getConnection()
    {
        return $this->connection;
    }

Usage Example

Exemple #1
0
 /**
  * Sets a field to a value. The column parameter determines if the "name" is a field or column name.
  *
  * @param object $entity
  * @param string $name
  * @param mixed  $value
  * @param bool   $column
  * @param bool   $convert
  */
 public function setValue($entity, $name, $value, $column = false, $convert = false)
 {
     if ($column && isset($this->fieldNames[$name])) {
         $name = $this->fieldNames[$name];
     }
     if (!property_exists($entity, $name) && !isset($entity->{$name})) {
         return;
     }
     if ($convert && isset($this->fields[$name])) {
         $value = Type::getType($this->fields[$name]['type'])->convertToPHPValue($value, $this->manager->getConnection()->getDatabasePlatform());
     }
     $entity->{$name} = $value;
 }