当前位置: 首页>>代码示例>>PHP>>正文


PHP Selection::getName方法代码示例

本文整理汇总了PHP中Nette\Database\Table\Selection::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Selection::getName方法的具体用法?PHP Selection::getName怎么用?PHP Selection::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Database\Table\Selection的用法示例。


在下文中一共展示了Selection::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCount

 /**
  * Get count of data
  * @return int
  */
 public function getCount()
 {
     try {
         $primary = $this->data_source->getPrimary();
     } catch (\LogicException $e) {
         return $this->data_source->count('*');
     }
     return $this->data_source->count($this->data_source->getName() . '.' . (is_array($primary) ? reset($primary) : $primary));
 }
开发者ID:ublaboo,项目名称:datagrid,代码行数:13,代码来源:NetteDatabaseTableDataSource.php

示例2: buildJoins

 protected function buildJoins($val, $inner = FALSE)
 {
     $driver = $this->selection->getConnection()->getSupplementalDriver();
     $reflection = $this->selection->getConnection()->getDatabaseReflection();
     $joins = array();
     preg_match_all('~\\b([a-z][\\w.:]*[.:])([a-z]\\w*|\\*)(\\s+IS\\b|\\s*<=>)?~i', $val, $matches);
     foreach ($matches[1] as $names) {
         $parent = $this->selection->getName();
         if ($names !== "{$parent}.") {
             // case-sensitive
             preg_match_all('~\\b([a-z][\\w]*|\\*)([.:])~i', $names, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 list(, $name, $delimiter) = $match;
                 if ($delimiter === ':') {
                     list($table, $primary) = $reflection->getHasManyReference($parent, $name);
                     $column = $reflection->getPrimary($parent);
                 } else {
                     list($table, $column) = $reflection->getBelongsToReference($parent, $name);
                     $primary = $reflection->getPrimary($table);
                 }
                 $joins[$name] = ' ' . (!isset($joins[$name]) && $inner && !isset($match[3]) ? 'INNER' : 'LEFT') . ' JOIN ' . $driver->delimite($table) . ($table !== $name ? ' AS ' . $driver->delimite($name) : '') . ' ON ' . $driver->delimite($parent) . '.' . $driver->delimite($column) . ' = ' . $driver->delimite($name) . '.' . $driver->delimite($primary);
                 $parent = $name;
             }
         }
     }
     return $joins;
 }
开发者ID:cujan,项目名称:atlas-mineralov-a-hornin,代码行数:27,代码来源:SqlBuilder.php

示例3: related

 /**
  * Returns referencing rows.
  * @param  string
  * @param  string
  * @return GroupedSelection
  */
 public function related($key, $throughColumn = NULL)
 {
     $groupedSelection = $this->table->getReferencingTable($key, $throughColumn, $this[$this->table->getPrimary()]);
     if (!$groupedSelection) {
         throw new Nette\MemberAccessException("No reference found for \${$this->table->getName()}->related({$key}).");
     }
     return $groupedSelection;
 }
开发者ID:nette,项目名称:database,代码行数:14,代码来源:ActiveRow.php

示例4: offsetGet

 /**
  * Returns specified row.
  *
  * @param mixed $key Row's primary key
  * @return HyperRow|NULL if there is no such row
  */
 public function offsetGet($key)
 {
     $result = $this->selection->offsetGet($key);
     if ($result instanceof ActiveRow) {
         return $this->factory->createRow($result, $this->selection->getName());
     }
     return $result;
 }
开发者ID:filsedla,项目名称:hyperrow,代码行数:14,代码来源:HyperSelection.php

示例5: __isset

 public function __isset($key)
 {
     $this->access($key);
     if (array_key_exists($key, $this->data)) {
         return isset($this->data[$key]);
     }
     list($table, $column) = $this->table->getConnection()->getDatabaseReflection()->getBelongsToReference($this->table->getName(), $key);
     $referenced = $this->getReference($table, $column);
     if (!isset($referenced)) {
         $this->access($key, TRUE);
         return FALSE;
     }
     return TRUE;
 }
开发者ID:exesek,项目名称:nette20login,代码行数:14,代码来源:ActiveRow.php

示例6: list

 public function &__get($key)
 {
     $this->access($key);
     if (array_key_exists($key, $this->data)) {
         return $this->data[$key];
     }
     $this->access($key, TRUE);
     list($table, $column) = $this->table->getConnection()->getDatabaseReflection()->getBelongsToReference($this->table->getName(), $key);
     $referenced = $this->getReference($table, $column);
     if ($referenced !== FALSE) {
         return $referenced;
     }
     throw new Nette\MemberAccessException("Cannot read an undeclared column \"{$key}\".");
 }
开发者ID:kravco,项目名称:nette,代码行数:14,代码来源:ActiveRow.php

示例7: list

 public function &__get($key)
 {
     $this->accessColumn($key);
     if (array_key_exists($key, $this->data)) {
         return $this->data[$key];
     }
     try {
         list($table, $column) = $this->table->getDatabaseReflection()->getBelongsToReference($this->table->getName(), $key);
         $referenced = $this->getReference($table, $column);
         if ($referenced !== FALSE) {
             $this->accessColumn($key, FALSE);
             return $referenced;
         }
     } catch (MissingReferenceException $e) {
     }
     $this->removeAccessColumn($key);
     throw new Nette\MemberAccessException("Cannot read an undeclared column \"{$key}\".");
 }
开发者ID:Johnik010,项目名称:rezervace,代码行数:18,代码来源:ActiveRow.php

示例8: createSelection

 /**
  * @param Selection $selection
  * @return HyperSelection
  */
 public function createSelection(Selection $selection)
 {
     $tableName = $selection->getName();
     $className = Helpers::substituteClassWildcard($this->selectionMapping, $tableName);
     $baseClass = HyperSelection::class;
     if (!class_exists($className) || !is_subclass_of($className, $baseClass)) {
         throw new InvalidStateException("HyperSelection class {$className} does not exist or does not extend {$baseClass}.");
     }
     $names = $this->container->findByType($className);
     if (count($names) > 1) {
         throw new InvalidStateException("Multiple services of type {$className} found: " . implode(', ', $names) . '.');
     } elseif (count($names) == 0) {
         $inst = $this->container->createInstance($className);
     } else {
         $name = array_shift($names);
         $inst = $this->container->createService($name);
     }
     /** @var HyperSelection $inst */
     $inst->setFactory($this);
     $inst->setSelection($selection);
     return $inst;
 }
开发者ID:filsedla,项目名称:hyperrow,代码行数:26,代码来源:Factory.php

示例9: createRow

 /**
  * Creates a new row.
  * @param  mixed[]
  * @param  \Nette\Database\Table\Selection
  * @return \Nette\Database\Table\ActiveRow
  */
 public function createRow(array $data, \Nette\Database\Table\Selection $table)
 {
     $class = $this->getRowClass($table->getName());
     return new $class($data, $table);
 }
开发者ID:fabik,项目名称:database,代码行数:11,代码来源:RowFactory.php


注:本文中的Nette\Database\Table\Selection::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。