本文整理汇总了PHP中eq函数的典型用法代码示例。如果您正苦于以下问题:PHP eq函数的具体用法?PHP eq怎么用?PHP eq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEmail
/**
* Displays the form to allow a user to enter their email
*
* @param Request $request
* @return \Illuminate\View\View
*/
public function getEmail(Request $request)
{
if (eq($request->segment(1), 'backend')) {
return view('backend.auth.forgot_password');
}
return view('auth.forgot_password');
}
示例2: move
/**
* @role update
*/
public function move()
{
$page = StaticPage::getInstanceById((int) $this->request->get('id'), StaticPage::LOAD_DATA);
// update parent
if ($this->request->get('parent')) {
$parent = StaticPage::getInstanceById((int) $this->request->get('parent'), StaticPage::LOAD_DATA);
} else {
$parent = null;
}
$page->parent->set($parent);
$page->save();
// update order
$f = new ARUpdateFilter();
if ($parent) {
$f->setCondition(eq(f('StaticPage.parentID'), $parent->getID()));
} else {
$f->setCondition(new IsNullCond(f('StaticPage.parentID')));
}
$f->addModifier('StaticPage.position', new ARExpressionHandle('position+2'));
if ($this->request->get('previous')) {
$previous = StaticPage::getInstanceById((int) $this->request->get('previous'), StaticPage::LOAD_DATA);
$position = $previous->position->get();
$f->mergeCondition(gt(f('StaticPage.position'), $position));
$page->position->set($position + 1);
} else {
$previous = null;
$page->position->set(1);
}
ActiveRecordModel::updateRecordSet('StaticPage', $f);
$page->save();
return new JSONResponse(array(), 'success', $this->translate('_pages_were_successfully_reordered'));
}
示例3: __construct
/**
* @param AuthenticateUser $authenticateUser
* @param Request $request
*/
public function __construct(AuthenticateUser $authenticateUser, Request $request)
{
$this->middleware('guest', ['except' => 'getLogout', 'getActivate']);
$this->auth = $authenticateUser;
$this->request = $request;
$this->backend = eq($request->segment(1), 'backend') ? true : false;
}
示例4: testRunStar
public function testRunStar()
{
$result = runStar(function ($q, $r) {
return disjPlus(eq($q, 2), eq($q, 3), eq($q, 4));
});
$this->assertEquals('(2 . (3 . (4)))', sprintf('%s', $result));
}
示例5: getInstance
public static function getInstance(OrderedItem $item, ProductFile $file)
{
$instance = $item->getRelatedRecordSet('OrderedFile', select(eq('OrderedFile.productFileID', $file->getID())))->shift();
if (!$instance) {
$instance = self::getNewInstance($item, $file);
}
return $instance;
}
示例6: testSecondSetT2
public function testSecondSetT2()
{
$x = callFresh(function ($q) {
return eq($q, 5);
});
$result = $x(emptyState());
$this->assertEquals('()', sprintf('%s', cdr($result)));
}
示例7: getRecordCount
public static function getRecordCount($locale = null)
{
$filter = new ARSelectFilter();
if ($locale) {
$filter->mergeCondition(eq(f(__CLASS__ . '.locale'), $locale));
}
return ActiveRecordModel::getRecordCount(__CLASS__, $filter);
}
示例8: loadDefaultImage
private function loadDefaultImage()
{
if (!isset($this->object['DefaultImage']) && isset($this->object['defaultImageID'])) {
$defaultImageArray = ActiveRecordModel::getRecordSetArray('ProductImage', select(eq(f('ProductImage.ID'), $this->object['defaultImageID'])));
if (count($defaultImageArray) > 0) {
$this->object['DefaultImage'] = array_merge(current($defaultImageArray), array('Product' => ActiveRecord::getArrayData('Product-' . $this->object['ID'])));
}
}
}
示例9: getSelectFilter
protected function getSelectFilter()
{
if (!$this->selectFilter) {
$this->selectFilter = select(eq('CustomerOrder.isFinalized', true), isnotnull('CustomerOrder.invoiceNumber'));
$this->selectFilter->setOrder(f('CustomerOrder.dateCompleted'), 'DESC');
$this->selectFilter->setLimit(1);
}
return $this->selectFilter;
}
示例10: getPastOrders
public function getPastOrders()
{
if (!is_null($this->pastOrders)) {
return $this->pastOrders;
}
if (!$this->user) {
return array();
}
$sessionUser = SessionUser::getUser();
if ($this->isSessionCacheUsable()) {
$session = new Session();
$sessionHandler = ActiveRecordModel::getApplication()->getSessionHandler();
$pastOrders = $session->get('pastOrders');
if (!$pastOrders || $pastOrders['cacheUpdated'] != $sessionHandler->getCacheUpdateTime()) {
unset($pastOrders);
}
}
if (empty($pastOrders)) {
$f = select(eq('CustomerOrder.userID', $this->user->getID()), eq('CustomerOrder.isFinalized', true), eq('CustomerOrder.isCancelled', 0), eq('CustomerOrder.isPaid', true));
$f->setOrder(f('OrderedItem.customerOrderID'), 'DESC');
$records = ActiveRecordModel::getRecordSetArray('OrderedItem', $f, array('CustomerOrder', 'Product'));
// load variation parent products separately
$parentIDs = array();
foreach ($records as $record) {
if ($record['Product']['parentID']) {
//$parentIDs[$record['Product']['parentID']] = true;
}
}
if ($parentIDs) {
$parents = array();
foreach (ActiveRecordModel::getRecordSetArray('Product', select(in('Product.ID', array_keys($parentIDs)))) as $parent) {
$parents[$parent['ID']] = $parent;
}
foreach ($records as &$record) {
if ($record['Product']['parentID']) {
$record['Product']['Parent'] = $parents[$record['Product']['parentID']];
}
}
}
// split records by orders
$orders = array();
foreach ($records as $record) {
$orders[$record['customerOrderID']][] = $record;
}
$pastOrders = array();
foreach ($orders as $order) {
$pastOrders[] = new RuleOrderContainer($order);
}
$pastOrders = array('cacheUpdated' => time(), 'orders' => $pastOrders);
}
if ($this->isSessionCacheUsable()) {
$session->set('pastOrders', $pastOrders);
$sessionHandler->updateCacheTimestamp();
}
$this->pastOrders = $pastOrders;
return $this->pastOrders;
}
示例11: getInstanceByDateTime
public static function getInstanceByDateTime($date, $time)
{
$f = new ARSelectFilter();
$f->setCondition(new AndChainCondition(array(eq(f('EyeExamSchedule.date'), $date), eq(f('EyeExamSchedule.time'), $time), isnull(f('EyeExamSchedule.eyeExamRequestID')))));
$s = self::getRecordSet('EyeExamSchedule', $f);
if (!$s->size()) {
return null;
}
return $s->get(0);
}
示例12: getThemeByProduct
public static function getThemeByProduct(Product $product)
{
$c = eq(__CLASS__ . '.productID', $product->getID());
$c->addOr(self::getCategoryCondition($product->getCategory()));
$f = select($c);
$f->setOrder(new ARExpressionHandle('CategoryPresentation.productID=' . $product->getID()), 'DESC');
self::setCategoryOrder($product->getCategory(), $f);
// check if a theme is defined for this product particularly
$set = ActiveRecordModel::getRecordSet(__CLASS__, $f, array('Category'));
return self::getInheritedConfig($set);
}
示例13: contains
/**
* Tests whether the specified comparable object
* is in this binary search tree.
*
* @param object IComparable $obj The object for which to look.
* @return boolean True if the specified object
* is in this binary search tree; false otherwise.
*/
public function contains(IComparable $obj)
{
if ($this->isEmpty()) {
return false;
} elseif (eq($obj, $this->getKey())) {
return true;
} elseif (lt($obj, $this->getKey())) {
return $this->getLeft()->contains($obj);
} else {
return $this->getRight()->contains($obj);
}
}
示例14: news
public function news()
{
$this->shouldBeEnabledFeed('NEWS_POSTS');
$this->setLayout('empty');
$response = new XMLResponse();
$f = select(eq(f('NewsPost.isEnabled'), true));
$f->setLimit($this->config->get('NUMBER_OF_NEWS_POSTS_TO_INCLUDE'));
$f->setOrder(f('NewsPost.position'), ARSelectFilter::ORDER_DESC);
$response->set('feed', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
$this->application->getLocale()->translationManager()->loadFile('News');
return $response;
}
示例15: addCategory
public function addCategory()
{
$category = Category::getInstanceByID($this->request->get('id'), ActiveRecord::LOAD_DATA, array('Category'));
$relatedCategory = Category::getInstanceByID($this->request->get('categoryId'), ActiveRecord::LOAD_DATA);
// check if the category is not assigned to this category already
$f = select(eq('CategoryRelationship.relatedCategoryID', $relatedCategory->getID()));
if ($category->getRelatedRecordSet('CategoryRelationship', $f)->size()) {
return new JSONResponse(false, 'failure', $this->translate('_err_already_assigned'));
}
$relation = CategoryRelationship::getNewInstance($category, $relatedCategory);
$relation->save();
$relatedCategory->getPathNodeSet();
return new JSONResponse(array('data' => $relation->toFlatArray()));
}