本文整理汇总了PHP中Nette\Database\Table\Selection类的典型用法代码示例。如果您正苦于以下问题:PHP Selection类的具体用法?PHP Selection怎么用?PHP Selection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Selection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: appendLimit
static function appendLimit(Nette\Database\Table\Selection &$query, $limit = NULL, $offset = NULL)
{
if (!is_null($limit)) {
$query->limit($limit, $offset);
}
return $query;
}
开发者ID:trejjam,项目名称:utils,代码行数:7,代码来源:BaseQuery.php
示例2: filterSection
/**
* @param Selection $context
* @param int $sectionId
* @param string $via [optional]
* @return Selection
*/
public function filterSection(Selection $context, $sectionId, $via = '')
{
$context->alias($this->sectionTableName, 'alternate_section');
$filterFactory = new Filter\Factory($this->sectionTableName);
$nFilter = $filterFactory->createN($context);
$nFilter->setup('id', $sectionId)->via("{$via}:page_has_section");
$nFilter->setup('id', $sectionId, 'alternate_section')->via($via);
return $nFilter->build();
}
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:15,代码来源:PageFilter.php
示例3: setModel
/**
* Nastavi model
* @param Nette\Database\Table\Selection
*/
public function setModel(\Nette\Database\Table\Selection $model)
{
if (isset($this->filter['email']) && $this->filter['email'] != '') {
$model->where('adress REGEXP ?', $this->filter['email']);
}
if (isset($this->filter['subject']) && $this->filter['subject'] != '') {
$model->where('subject REGEXP ?', $this->filter['subject']);
}
$this->model = $model;
}
开发者ID:vsek,项目名称:base,代码行数:14,代码来源:GridEmailLog.php
示例4: apply
/**
* @param \Nette\Database\Table\Selection $selection
* @param string|Callable $callback
*/
private function apply(Selection $selection, $callback)
{
if (!$callback) {
return;
}
if (is_string($callback)) {
$selection->select($callback);
} else {
$callback($selection);
}
}
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:15,代码来源:MenuItemDataSource.php
示例5: 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
示例6: isset
$for_link = $abs_link . ($v->druh->presenter == "Menu" ? "Clanky" : $v->druh->presenter) . ":";
$temp_pol = new \App\FrontModule\Components\Menu\MenuNode();
$temp_pol->name = $ja->nazov;
$temp_pol->tooltip = $ja->h1part2;
$temp_pol->avatar = $v->avatar;
$temp_pol->anotacia = $v->druh->presenter == "Clanky" && isset($ja->clanok_lang->anotacia) ? $ja->clanok_lang->anotacia : FALSE;
$temp_pol->node_class = $v->ikonka !== NULL && strlen($v->ikonka) > 2 ? "fa fa-" . $v->ikonka : NULL;
$temp_pol->link = $v->druh->je_spec_naz ? array($for_link) : $for_link;
$temp_pol->absolutna = $v->absolutna;
$temp_pol->novinka = $v->id_dlzka_novinky > 1 ? $v->modified->add(new \DateInterval('P' . $v->dlzka_novinky->dlzka . 'D')) : NULL;
$temp_pol->id = $v->id;
$temp_pol->poradie_podclankov = $v->poradie_podclankov;
$out[] = array("node" => $temp_pol, "nadradena" => isset($v->id_nadradenej) ? $v->id_nadradenej : -1 * $v->hlavne_menu_cast->id);
unset($temp_pol);
}
return $out;
}
/** Vypis menu pre Admin modul
* @param int $id_reg Min. id registrácie
* @param type $lang_id Id jazyka
* @return array|FALSE
*/
public function getMenuAdmin($id_reg, $lang_id = 1)
{
$polozky = $this->hlavne_menu_lang->where("hlavne_menu.id_registracia <= ?", $id_reg)->where("id_lang", $lang_id)->where("hlavne_menu.druh.modul IS NULL OR hlavne_menu.druh.modul = ?", "Admin")->order('hlavne_menu.id_hlavne_menu_cast, hlavne_menu.uroven, hlavne_menu.poradie ASC');
return $polozky !== FALSE && count($polozky) ? $this->_getMenuAdmin($polozky) : FALSE;
}
/** Vytvorenie menu pre administraciu
* @param Nette\Database\Table\Selection $polozky Vyber poloziek hl. menu
* @return array|FALSE
*/
private function _getMenuAdmin($polozky)
{
$cislo_casti = 0;
//aktualne cislo casti
$casti = array();
$out = array();
foreach ($polozky as $ja) {
$v = $ja->hlavne_menu;
//Mam taku istu cast ako pred tym? Ak nie nastav cislo casti, ale len ak je to dovolene cez $casti
if ($cislo_casti !== $v->id_hlavne_menu_cast) {
//Mam taku istu cast ako pred tym? Ak nie nastav cislo casti
$cislo_casti = $v->id_hlavne_menu_cast;
$casti[] = $cislo_casti;
$temp_pol = new \App\AdminModule\Components\Menu\MenuNode();
$temp_pol->name = $v->hlavne_menu_cast->nazov;
$temp_pol->link = array("Homepage:");
$temp_pol->id = -1 * $v->hlavne_menu_cast->id;
$out[] = array("node" => $temp_pol, "nadradena" => FALSE);
开发者ID:petak23,项目名称:scspp,代码行数:49,代码来源:Hlavne_menu.php
示例7: getData
/**
* @param int $limit
* @param int $offset
* @return array
*/
public function getData($limit = NULL, $offset = NULL)
{
if ($limit !== NULL) {
$this->source->limit($limit, $offset);
}
return $this->source->fetchAll();
}
开发者ID:WebChemistry,项目名称:filter,代码行数:12,代码来源:NetteDataSource.php
示例8: render
public function render()
{
$this->_calendarMonthData->rewind();
$this->template->data = $this->_calendarMonthData;
$this->template->setFile(__DIR__ . '/Month.latte');
$this->template->render();
}
开发者ID:dansilovsky,项目名称:calendar,代码行数:7,代码来源:MonthControl.php
示例9: process
/**
* Default form handler
*/
public function process()
{
/** @var ArrayHash $values */
$values = $this->values;
try {
$this->onBeforeProcess($this, $values);
if (isset($values->id)) {
$this->onBeforeUpdate($this, $values);
$arr = (array) $values;
unset($arr['id']);
$row = $this->selection->wherePrimary($values->id)->fetch();
$row->update($arr);
$this->onAfterUpdate($row, $this, $values);
} else {
$this->onBeforeInsert($this, $values);
$row = $this->selection->insert($values);
$this->onAfterInsert($row, $this, $values);
}
$this->onAfterProcess($row, $this, $values);
} catch (\PDOException $e) {
$this->addError($e->getMessage());
dump($e);
Debugger::log($e);
}
}
开发者ID:ondrs,项目名称:nette-bootstrap,代码行数:28,代码来源:BaseForm.php
示例10: filter
/**
* Filter data
* @param array $filter
*/
public function filter(array $filter)
{
foreach ($filter as $key => $value) {
$value = is_numeric($value) ? $value : '%' . $value . '%';
$this->table->where($key . ' LIKE ?', $value);
}
}
开发者ID:drahak,项目名称:tables,代码行数:11,代码来源:DefaultDataSource.php
示例11: validate
public function validate(BaseControl $control)
{
$condition[$control->name] = $control->value;
if ($this->id) {
$condition['id!='] = $this->id;
}
return $this->selection->where($condition)->count() ? FALSE : TRUE;
}
开发者ID:04EO,项目名称:TrainingTaskNette,代码行数:8,代码来源:UniqueValidator.php
示例12: setTexts
/** Nastavenie textov
* @param array $texts
* @return \App\FrontModule\Components\Clanky\AktualneClankyControl
*/
public function setTexts($texts)
{
$this->texts = array_merge($this->texts, $texts);
return $this;
}
/** Nastavenie cesty k titulnemu obrazku clanku
开发者ID:petak23,项目名称:echo-msz,代码行数:10,代码来源:AktualneClanky.php
示例13: render
if (is_int($pocet) && $pocet > 1) {
$this->pocet = $pocet;
}
}
/** Zakladny render */
public function render()
{
$this->template->setFile(__DIR__ . '/Last.latte');
$this->template->h3 = 'Posledných ' . $this->pocet . ' prihlásení';
$this->template->last = $this->last->order('prihlasenie_datum DESC')->limit($this->pocet);
$this->template->render();
开发者ID:petak23,项目名称:echo-msz,代码行数:11,代码来源:Last.php
示例14: getProdukt
/** Nacitanie udajov o produkte
* @param int $id Id produktu
* @param int $id_lang Id jazyka
* @return array|FALSE
*/
public function getProdukt($id, $id_lang = 1)
{
$hlavne_menu_lang = $this->hlavne_menu_lang->where(array("id_hlavne_menu" => $id, "id_lang" => $id_lang));
if ($hlavne_menu_lang === FALSE) {
return FALSE;
}
$produkt = $this->find($hlavne_menu_lang->hlavne_menu->clanok);
if ($produkt === FALSE) {
return FALSE;
}
return array("hlavne_menu_lang" => $hlavne_menu_lang, "produkt" => $produkt);
}
开发者ID:petak23,项目名称:echo-msz,代码行数:17,代码来源:Produkt_lang.php
示例15: 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
示例16: update
public function update($data, $forceRegenerateTimes = FALSE)
{
parent::update($data);
if ($forceRegenerateTimes || rand(0, 100) < 10) {
$this->generateAllTimes();
}
}
开发者ID:soundake,项目名称:pd,代码行数:7,代码来源:EventsTerms.php
示例17: access
public function access($key, $delete = FALSE)
{
if ($this->table->connection->getCache() && !isset($this->modified[$key]) && $this->table->access($key, $delete)) {
$id = isset($this->data[$this->table->primary]) ? $this->data[$this->table->primary] : $this->data;
$this->data = $this->table[$id]->data;
}
}
开发者ID:kovkus,项目名称:r-cms,代码行数:7,代码来源:ActiveRow.php
示例18: search
public function search($q)
{
$query = "";
$count = count($this->columns);
$i = 0;
$phldrs = array();
foreach ($this->columns as $column) {
$query .= new \Nette\Database\SqlLiteral($column . " " . $this->method . " ?");
$phldrs[] = str_replace($this->placeholder, $q, $this->mask);
if ($i < $count - 1) {
$query .= " OR ";
}
$i++;
}
return $this->model->where($query, $phldrs);
}
开发者ID:sg3tester,项目名称:songator,代码行数:16,代码来源:Searcher.php
示例19: actionDefault
/**
* Pad:default.
* @param int $id
* @param string|null $order
* @throws BadRequestException
*/
public function actionDefault($id, $order)
{
$this->loadPad($id);
$this->notes = $this->noteManager->findByPad($id);
if ($order) {
$this->notes->order(OrderHelper::translateParameterToColumns($order));
}
}
开发者ID:shutkos,项目名称:notejam,代码行数:14,代码来源:PadPresenter.php
示例20: execute
protected function execute()
{
if ($this->rows !== NULL) {
return;
}
parent::execute();
$this->onExecute();
}
开发者ID:redwormik,项目名称:fakeorm,代码行数:8,代码来源:Selection.php
注:本文中的Nette\Database\Table\Selection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论