Phalcon Framework 3.4.5

Phalcon\Mvc\Model\Exception: At least one value must be bound in placeholder: projects

/home/property/domains/property.vision-org.com/public_html/touch/modules/website/controllers/SearchController.php (170)
#0Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 277, [value] => projects:array))
#1Phalcon\Mvc\Model\Query->_getExpression(Array([0] => Array([type] => 277, [value] => projects:array)), true)
#2Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 315, [left] => Array([type] => 355, [name] => project_id), [right] => Array([0] => Array([type] => 277, [value] => projects:array))), true)
#3Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 266, [left] => Array([type] => 274, [value] => country), [right] => Array([type] => 315, [left] => Array([type] => 355, [name] => project_id), [right] => Array([0] => Array()))), true)
#4Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 61, [left] => Array([type] => 61, [left] => Array([type] => 355, [name] => is_published), [right] => Array([type] => 266, [left] => Array(), [right] => Array())), [right] => Array([type] => 266, [left] => Array([type] => 274, [value] => country), [right] => Array([type] => 315, [left] => Array(), [right] => Array()))))
#5Phalcon\Mvc\Model\Query->_prepareSelect()
#6Phalcon\Mvc\Model\Query->parse()
#7Phalcon\Mvc\Model\Query->execute()
#8Phalcon\Mvc\Model::find(Array([conditions] => is_published = 1 and deleted_at is null and country_id = :country: and project_id IN ({projects:array}), [bind] => Array([country] => 3, [projects] => Array()), [order] => created_at DESC))
/home/property/domains/property.vision-org.com/public_html/touch/modules/website/controllers/SearchController.php (170)
<?php
 
namespace touch\modules\website\controllers;
 
 
use touch\library\Utils\Pagination;
use touch\library\Utils\Utils;
use touch\models\DeveloperProjects;
use touch\models\Properties;
 
use \Phalcon\Paginator\Adapter\Model as Paginator;
 
 
class SearchController extends ControllerBase
{
    public function indexAction(int $page)
    {
 
        \Phalcon\Tag::prependTitle('Search in Properties');
 
 
        $query = $this->request->getQuery('q');
 
        $ref = $this->request->getQuery('ref', 'alphanum');
        $type = $this->request->getQuery('type', 'int!', 0);
        $country = $this->request->getQuery('country', 'int!', 0);
        $location = $this->request->getQuery('location', 'int!', 0);
        $price_range = $this->request->getQuery('price_range', 'int!', 0);
        $sort_by = $this->request->getQuery('sort_by');
        $limit = $this->request->getQuery('per_page', 'int!', self::ITEM_PER_PAGE);
        $limit = $limit > 0 ? $limit : self::ITEM_PER_PAGE;
 
 
        $bedrooms = $this->request->getQuery('bedrooms', 'int!', -1);
        $status = $this->request->getQuery('status', 'int!', -1);
        $swimming_pool = $this->request->getQuery('swimming_pool', 'int!', -1);
        $built_type = $this->request->getQuery('built_type', 'int!', -1);
 
        $key = $this->request->getQuery('key');
 
 
        $default_condition = 'is_published = 1 and deleted_at is null';
        $default_bind = [];
 
        if($key)
        {
            switch ($key)
            {
                case 'penthouse':
                    $default_condition .= ' and title like :key: ';
                    $default_bind['key'] = "%penthouse%";
                    break;
                case 'townhouse':
                    $default_condition .= ' and (title like :key1: or title like :key2:)';
                    $default_bind['key1'] = "%townhouse%";
                    $default_bind['key2'] = "%semi%de%tache%";
                    break;
 
                case 'finca':
                    $default_condition .= ' and (title like :key1: or title like :key2:)';
                    $default_bind['key1'] = "%country property%";
                    $default_bind['key2'] = "%finca%";
                    break;
 
                case 'new_releases':
                    $default_condition .= ' and created_at BETWEEN :two_months_ago: and :today:';
                    $default_bind['two_months_ago'] = date('Y-m-d H:i:s', time()-(60*60*24*60));
                    $default_bind['today'] = date('Y-m-d H:i:s', time());
                    break;
 
                case 'luxury':
                    $default_condition.= ' and price >= :price:';
                    $default_bind['price'] = $country == 4 ? 300000 : ($country == 2 ? 1000000 : 300000);
                    break;
 
                case 'investment':
                    // offplan, under construction
                    $default_condition.= ' and (status = 1 or status = 2)';
                    break;
 
                case 'newly_launched':
                    $default_condition.= ' and status = 1';
                    break;
 
                default:
                    break;
            }
        }
 
 
 
        if($ref) {
            $default_condition .= ' and code like :code:';
            $default_bind['code'] = "%{$ref}%";
        }
 
        if($type > 0)
        {
            $default_condition .= ' and type_id = :type:';
            $default_bind['type'] = $type;
        }
 
        if($country > 0)
        {
            $default_condition .= ' and country_id = :country:';
            $default_bind['country'] = $country;
        }
        if($location > 0)
        {
 
            $projects = DeveloperProjects::find(['deleted_at is null and location_id=:location:', 'bind'=>['location'=>$location]]);
 
            if($projects)
            {
                $project_ids = [];
                foreach($projects as $project)
                {
                    $project_ids[] = $project->id;
                }
 
                $default_condition .= ' and project_id IN ({projects:array})';
                $default_bind['projects'] = $project_ids;
            }
 
 
        }
 
        if($price_range > 0 && $price_range < count(Utils::PRICE_RANGES))
        {
            $default_condition .= ' and (price BETWEEN :start: AND :end:)';
            $default_bind['start'] = Utils::PRICE_RANGES[$price_range]['start'];
            $default_bind['end'] = Utils::PRICE_RANGES[$price_range]['end'];
        }
 
        if($bedrooms > -1)
        {
            $default_condition .= ' and feature_bedrooms = :bedrooms:';
            $default_bind['bedrooms'] = $bedrooms;
        }
 
        if($status > -1)
        {
            $default_condition .= ' and status = :status:';
            $default_bind['status'] = $status;
        }
 
        if($swimming_pool > -1)
        {
            $default_condition .= ' and feature_swimming_pool = :swimming_pool:';
            $default_bind['swimming_pool'] = $swimming_pool;
        }
 
        if($built_type > -1)
        {
            $default_condition .= ' and built_type = :built_type:';
            $default_bind['built_type'] = $built_type;
        }
 
        $sortes = [
            'date_desc' => 'created_at DESC',
            'date_asc' => 'created_at ASC',
            'price_desc' => 'price DESC',
            'price_asc' => 'price ASC'
        ];
 
 
        $properties = Properties::find([
            'conditions' => $default_condition,
            'bind' => $default_bind,
            'order' => isset($sortes[$sort_by]) ? $sortes[$sort_by] : 'created_at DESC'
        ]);
 
        $paginator = new Paginator([
            'data' => $properties,
            'limit' => $limit,
            'page' => $page
        ]);
 
        $data = $paginator->getPaginate();
 
        $urlPattern = $this->router->getRouteByName('website-module-search-page')->getPattern();
        $urlPattern = $this->url->getBaseUri() . ltrim($urlPattern, '/');
 
        $queries = $this->request->getQuery();
        unset($queries['_url']);
        $url = http_build_query($queries);
 
        $pagination = new Pagination($data->total_items, $data->limit, $data->current, $urlPattern."?".$url);
        $pagination->setMaxPagesToShow(5);
 
        $this->view->setVar('properties', $data);
        $this->view->setVar('pagination', $pagination);
        $this->view->setVar('q', $query);
 
    }
 
}
#9touch\modules\website\controllers\SearchController->indexAction(1)
#10Phalcon\Dispatcher->callActionMethod(Object(touch\modules\website\controllers\SearchController), indexAction, Array([page] => 1))
#11Phalcon\Dispatcher->dispatch()
#12Phalcon\Mvc\Application->handle()
/home/property/domains/property.vision-org.com/public_html/public/index.php (46)
<?php
 
// require 'maintenance.php';
 
 
use Phalcon\Debug;
use Phalcon\Http\Response;
use Phalcon\Logger\Adapter\File as Logger;
use RuntimeException as Exception;
 
define('PRIVATE_DIR', __DIR__.'/../touch');
define('COMPONENT_DIR', PRIVATE_DIR.'/modules');
define('THEME_DIR',PRIVATE_DIR.'/themes');
 
error_reporting(E_ALL);
ini_set('display_errors', 1);
 
require PRIVATE_DIR.'/vendors/autoload.php';
 
try
{
 
    $config = include PRIVATE_DIR . '/config.php';
 
    $debug = new Debug;
    $debug->listen();
 
    require PRIVATE_DIR . '/loader.php';
 
    require PRIVATE_DIR . '/services.php';
 
    /**
     * Handle the request
     */
    $application = new Phalcon\Mvc\Application();
 
    $application->setDI($di);
 
    /**
     * Register application modules
     */
    $active_modules = include PRIVATE_DIR . '/modules.php';
 
    $application->registerModules($active_modules);
 
    $response = $application->handle();
 
    $response->send();
 
}
catch (Exception $e) {
 
    if ($config->application->production) {
        // Log the exception
        $logger = new Logger($config->application->errorLog);
        $logger->error($e->getMessage());
        $logger->error($e->getTraceAsString());
        // Show an static error page
        $response = new Response();
        $response->redirect('404');
        $response->send();
    } else {
        echo $e->getMessage();
    }
}
KeyValue
_url/en/search
ref
key
type
country3
location9
price_range
sort_by
per_page12
KeyValue
REDIRECT_REDIRECT_UNIQUE_IDX5QirmjOBzARofeY5z2GDgAAAAM
REDIRECT_REDIRECT_HTTPSon
REDIRECT_REDIRECT_SSL_TLS_SNIproperty.vision-org.com
REDIRECT_REDIRECT_STATUS200
REDIRECT_UNIQUE_IDX5QirmjOBzARofeY5z2GDgAAAAM
REDIRECT_HTTPSon
REDIRECT_SSL_TLS_SNIproperty.vision-org.com
REDIRECT_STATUS200
UNIQUE_IDX5QirmjOBzARofeY5z2GDgAAAAM
HTTPSon
SSL_TLS_SNIproperty.vision-org.com
HTTP_HOSTproperty.vision-org.com
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip
HTTP_CF_IPCOUNTRYUS
HTTP_X_FORWARDED_FOR34.236.245.255
HTTP_CF_RAY5e73d060cf61156f-EWR
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_USER_AGENTCCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGEen-US,en;q=0.5
HTTP_IF_MODIFIED_SINCEFri, 10 Jul 2020 04:33:44 GMT
HTTP_CF_REQUEST_ID05fc40907a0000156f52b73000000001
HTTP_CF_CONNECTING_IP34.236.245.255
HTTP_CDN_LOOPcloudflare
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
SERVER_SIGNATURE
SERVER_SOFTWAREApache/2
SERVER_NAMEproperty.vision-org.com
SERVER_ADDR2.59.117.50
SERVER_PORT443
REMOTE_ADDR108.162.219.135
DOCUMENT_ROOT/home/property/domains/property.vision-org.com/private_html
REQUEST_SCHEMEhttps
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT/home/property/domains/property.vision-org.com/private_html
SERVER_ADMIN[email protected]
SCRIPT_FILENAME/home/property/domains/property.vision-org.com/private_html/public/index.php
REMOTE_PORT16908
REDIRECT_URL/public/en/search
REDIRECT_QUERY_STRING_url=/en/search&ref=&key=&type=&country=3&location=9&price_range=&sort_by&per_page=12
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.1
REQUEST_METHODGET
QUERY_STRING_url=/en/search&ref=&key=&type=&country=3&location=9&price_range=&sort_by&per_page=12
REQUEST_URI/en/search?ref=&key=&type=&country=3&location=9&price_range=&sort_by&per_page=12
SCRIPT_NAME/public/index.php
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1603543726.667
REQUEST_TIME1603543726
#Path
0/home/property/domains/property.vision-org.com/public_html/public/index.php
1/home/property/domains/property.vision-org.com/public_html/touch/vendors/autoload.php
2/home/property/domains/property.vision-org.com/public_html/touch/vendors/composer/autoload_real.php
3/home/property/domains/property.vision-org.com/public_html/touch/vendors/composer/ClassLoader.php
4/home/property/domains/property.vision-org.com/public_html/touch/vendors/composer/autoload_static.php
5/home/property/domains/property.vision-org.com/public_html/touch/vendors/ralouphie/getallheaders/src/getallheaders.php
6/home/property/domains/property.vision-org.com/public_html/touch/vendors/guzzlehttp/promises/src/functions_include.php
7/home/property/domains/property.vision-org.com/public_html/touch/vendors/guzzlehttp/promises/src/functions.php
8/home/property/domains/property.vision-org.com/public_html/touch/vendors/guzzlehttp/psr7/src/functions_include.php
9/home/property/domains/property.vision-org.com/public_html/touch/vendors/guzzlehttp/psr7/src/functions.php
10/home/property/domains/property.vision-org.com/public_html/touch/vendors/symfony/polyfill-mbstring/bootstrap.php
11/home/property/domains/property.vision-org.com/public_html/touch/vendors/symfony/polyfill-php72/bootstrap.php
12/home/property/domains/property.vision-org.com/public_html/touch/vendors/guzzlehttp/guzzle/src/functions_include.php
13/home/property/domains/property.vision-org.com/public_html/touch/vendors/guzzlehttp/guzzle/src/functions.php
14/home/property/domains/property.vision-org.com/public_html/touch/vendors/mtdowling/jmespath.php/src/JmesPath.php
15/home/property/domains/property.vision-org.com/public_html/touch/vendors/symfony/polyfill-iconv/bootstrap.php
16/home/property/domains/property.vision-org.com/public_html/touch/vendors/symfony/polyfill-intl-idn/bootstrap.php
17/home/property/domains/property.vision-org.com/public_html/touch/vendors/aws/aws-sdk-php/src/functions.php
18/home/property/domains/property.vision-org.com/public_html/touch/vendors/swiftmailer/swiftmailer/lib/swift_required.php
19/home/property/domains/property.vision-org.com/public_html/touch/vendors/swiftmailer/swiftmailer/lib/classes/Swift.php
20/home/property/domains/property.vision-org.com/public_html/touch/config.php
21/home/property/domains/property.vision-org.com/public_html/touch/loader.php
22/home/property/domains/property.vision-org.com/public_html/touch/services.php
23/home/property/domains/property.vision-org.com/public_html/touch/modules.php
24/home/property/domains/property.vision-org.com/public_html/touch/routes.php
25/home/property/domains/property.vision-org.com/public_html/touch/modules/website/Routes.php
26/home/property/domains/property.vision-org.com/public_html/touch/modules/website/Module.php
27/home/property/domains/property.vision-org.com/public_html/touch/modules/website/config/config.php
28/home/property/domains/property.vision-org.com/public_html/touch/modules/website/controllers/SearchController.php
29/home/property/domains/property.vision-org.com/public_html/touch/modules/website/controllers/ControllerBase.php
30/home/property/domains/property.vision-org.com/public_html/touch/controllers/ControllerBase.php
31/home/property/domains/property.vision-org.com/public_html/touch/library/Utils/Utils.php
32/home/property/domains/property.vision-org.com/public_html/touch/models/PropertyTypes.php
33/home/property/domains/property.vision-org.com/public_html/touch/models/BaseModel.php
34/home/property/domains/property.vision-org.com/public_html/touch/models/PropertyCountries.php
35/home/property/domains/property.vision-org.com/public_html/touch/models/Properties.php
36/home/property/domains/property.vision-org.com/public_html/touch/models/DeveloperProjects.php
Memory
Usage2097152