Nextras\Orm\Mapper\Dbal\StorageReflection\StorageReflection::convertEntityToStorageKey PHP Метод

convertEntityToStorageKey() публичный Метод

public convertEntityToStorageKey ( $key )
    public function convertEntityToStorageKey($key)
    {
        if (!isset($this->mappings[self::TO_STORAGE][$key][0])) {
            $this->mappings[self::TO_STORAGE][$key] = [$this->formatStorageKey($key)];
        }
        return $this->mappings[self::TO_STORAGE][$key][0];
    }

Usage Example

Пример #1
0
 /**
  * @param string   $propertyName
  * @param callable $toEntityTransform
  * @param callable $toSqlTransform
  * @throws InvalidPropertyException
  */
 public function addGenericArrayMapping($propertyName, callable $toEntityTransform, callable $toSqlTransform)
 {
     $this->validateProperty($propertyName);
     $this->storageReflection->addMapping($propertyName, $this->storageReflection->convertEntityToStorageKey($propertyName), function ($value) use($toEntityTransform) {
         return PgArray::parse($value, $toEntityTransform);
     }, function ($value) use($toSqlTransform) {
         return PgArray::serialize($value, $toSqlTransform);
     });
 }