Phalcon Framework 3.2.4

Error: Cannot access empty property

/var/www/html/apps/frontend/library/Prepare/Prepare.php (31)
#0Frontend\Prepare\Prepare->content(Object(Frontend\Models\Content: 13))
/var/www/html/apps/frontend/controllers/ControllerBase.php (90)
<?php
 
namespace Frontend\Controllers;
 
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Dispatcher;
use Frontend\Models\Hierarchy;
use Frontend\Cart\Cart;
 
use Frontend\Models\Content;
use Frontend\Models\Location;
 
/*
 * ControllerBase
 * This is the base controller for all controllers in the application
 */
class ControllerBase extends Controller{
  
  
  protected function initialize(){
 
    $this->tag->prependTitle('TKS | ');
 
    $this->view->setVar('lang', $this->getLang());
  }
  
  /*
   * Execute before the router so we can determine if this is a private controller, and must be authenticated, or a public controller that is open to all.
   * 
   * @param Dispatcher $dispatcher
   * @return boolean
   */
  public function beforeExecuteRoute(Dispatcher $dispatcher){
    
    // get controller and action name
    $this->session->set('moduleName',$dispatcher->getModuleName());
    $this->session->set('controllerName', $dispatcher->getControllerName());
    $this->session->set('actionName', $dispatcher->getActionName());
    
    // instantiate language
    $this->lang->initLang($this->dispatcher->getParam('lang'));
    $this->view->setVars(array(
      'langCode' => $this->session->get('langCode'),
      'curURL' => $this->router->getRewriteUri()
      ));
    $this->view->langCode = $this->session->get('langCode');
    
    /*
     * 
     */
    $controllerName = $dispatcher->getControllerName();
     
        // Only check permissions on private controllers
        if ($this->acl->isPrivate($controllerName)) {
 
            // Get the current identity
            $identity = $this->auth->getIdentity();
 
            // If there is no identity available the user is redirected to index/index
            if (!is_array($identity)) {
                $this->flashSession->notice('You don\'t have access to this section.');
        $this->response->redirect('/session/login');
        return false;
            }
 
            // Check if the user have permission to the current option
            $actionName = $dispatcher->getActionName();
            if (!$this->acl->isAllowed($identity['profile'], $controllerName, $actionName)) {
 
                $this->flash->notice('You don\'t have access to this module: ' . $controllerName . ':' . $actionName);
 
                if ($this->acl->isAllowed($identity['profile'], $controllerName, 'index')) {
                    $dispatcher->forward(array(
                        'controller' => $controllerName,
                        'action' => 'index'
                    ));
                } else {
                    $dispatcher->forward(array(
                        'controller' => 'user_control',
                        'action' => 'index'
                    ));
                }
 
                return false;
            }
        }
 
    // load main menu
    $this->view->mainMenu = $this->loadMainMenu();
    $this->view->logo = $this->prepare->content(Content::findFirst("content_id = 21"));
    $this->view->footerContact = $this->prepare->location(Location::findFirst("location_id = 1"));
    $this->view->associatedCompanyData = Content::find(
      array(
        "category_id = 218 AND status_active = 'Y' ",
        "order" => "content_id DESC",
        "limit" => 3
        )
      );
    $this->view->latestNewsData = Content::find(
      array(
        "category_id = 192 AND status_active = 'Y' ",
        "order" => "content_id DESC",
        "limit" => 3
        )
      );
 
    // init cart
    $cart = new Cart();
    $cart->initCart();
  }
  
  
  /*
   * 
   */
  protected function loadMainMenu(){
    $hierarchy = new Hierarchy();
    return $hierarchy->getHierarchyById(2);
  } 
  
  
  /*
   * 
   */
  protected function forward($uri){
        $uriParts = explode('/', $uri);
        $params = array_slice($uriParts, 2);
      return $this->dispatcher->forward(
        array(
          'controller' => $uriParts[0],
          'action' => $uriParts[1],
                'params' => $params
        )
      );
    }
  
  
  /*
   * 
   */
  protected function getLang(){
        return new \Frontend\Lang\Database(array(
            'db' => $this->di->get('db'), // Here we're getting the database from DI
            'table' => $this->config->database->langTableName, // The table that is storing the translations
            'language' => $this->session->get('langCode') // Now we're getting the best language for the user
        ));
    }
    
  protected function genQryByAry($field, $ary){
    $qry = '';
    if(!empty($ary)){
      $qry .= '(';
      foreach($ary as $value){
        $qry .= "$field = $value OR ";
      }
      $qry = rtrim($qry,'OR ');
      $qry .= ') AND ';
    }
    return $qry;
  }
  
  protected function printErrorMessage($obj, $options = array()){
    $responseMessage = '';
      foreach ($obj->getMessages() as $message) {
          $responseMessage .= $message . "<br/>";
        }
    
    if(array_key_exists('prepend',$options)){
      $responseMessage = $options['prepend'].'<br/>'.$responseMessage;
    }else if(array_key_exists('append',$options)){
      $responseMessage = $responseMessage.$options['append'];      
    }
    
    $responseMessage = rtrim($responseMessage,'<br/>');
    
      return $responseMessage;
  }
  
}
#1Frontend\Controllers\ControllerBase->beforeExecuteRoute(Object(Phalcon\Mvc\Dispatcher))
#2Phalcon\Dispatcher->dispatch()
#3Phalcon\Mvc\Application->handle()
/var/www/html/public/index.php (43)
<?php
 
// php runtime configuration
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('opcache.enable', 0);
 
// start phalcon instantiation
use Phalcon\Mvc\Application;
use Phalcon\DI\FactoryDefault;
 
$di = new FactoryDefault();
 
// Specify routes for modules
 
$di->set('router', function(){
  return require '../apps/routes.php';
  });
  
try{
  
  // Create an application
  $application = new Application($di);
  
  // Register the installed modules
  $application->registerModules(
    array(
      'frontend' => array(
        'className' => 'Frontend\Module',
        'path' => '../apps/frontend/Module.php'
        ),
      'backend' => array(
        'className' => 'Backend\Module',
        'path' => '../apps/backend/Module.php'      
        )
      )
    );
    
  $debug = new \Phalcon\Debug();
  $debug->listen();
    
  // Handle the request
  echo $application->handle()->getContent();
  
}catch(\Exception $e){
  
  echo $e->getMessage();
  
}
 
?>
KeyValue
_url/js/025291236
KeyValue
REDIRECT_REDIRECT_UNIQUE_IDZko5udkqVqF11AfU-11o1gAAAA8
REDIRECT_REDIRECT_STATUS200
REDIRECT_UNIQUE_IDZko5udkqVqF11AfU-11o1gAAAA8
REDIRECT_STATUS200
UNIQUE_IDZko5udkqVqF11AfU-11o1gAAAA8
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_COOKIEPHPSESSID=5rf1g6t842t02ekmcl15op11t2
HTTP_ACCEPT_ENCODINGgzip, br, zstd, deflate
HTTP_HOSTthaikoreanseaweed.co.th
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
SERVER_SIGNATURE
SERVER_SOFTWAREApache/2.4.6 (CentOS) PHP/7.0.27
SERVER_NAMEthaikoreanseaweed.co.th
SERVER_ADDR10.7.9.169
SERVER_PORT80
REMOTE_ADDR3.14.12.110
DOCUMENT_ROOT/var/www/html
REQUEST_SCHEMEhttp
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT/var/www/html
SERVER_ADMINroot@localhost
SCRIPT_FILENAME/var/www/html/public/index.php
REMOTE_PORT43318
REDIRECT_QUERY_STRING_url=/js/025291236
REDIRECT_URL/public/js/025291236
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.1
REQUEST_METHODGET
QUERY_STRING_url=/js/025291236
REQUEST_URI/js/025291236
SCRIPT_NAME/public/index.php
PHP_SELF/public/index.php
REQUEST_TIME_FLOAT1716140473.96
REQUEST_TIME1716140473
#Path
0/var/www/html/public/index.php
1/var/www/html/apps/routes.php
2/var/www/html/apps/frontend/Module.php
3/var/www/html/vendor/autoload.php
4/var/www/html/vendor/composer/autoload_real.php
5/var/www/html/vendor/composer/ClassLoader.php
6/var/www/html/vendor/composer/autoload_namespaces.php
7/var/www/html/vendor/composer/autoload_psr4.php
8/var/www/html/vendor/composer/autoload_classmap.php
9/var/www/html/vendor/composer/autoload_files.php
10/var/www/html/vendor/guzzlehttp/promises/src/functions_include.php
11/var/www/html/vendor/guzzlehttp/promises/src/functions.php
12/var/www/html/vendor/guzzlehttp/psr7/src/functions_include.php
13/var/www/html/vendor/guzzlehttp/psr7/src/functions.php
14/var/www/html/vendor/guzzlehttp/guzzle/src/functions_include.php
15/var/www/html/vendor/guzzlehttp/guzzle/src/functions.php
16/var/www/html/vendor/mtdowling/jmespath.php/src/JmesPath.php
17/var/www/html/vendor/swiftmailer/swiftmailer/lib/swift_required.php
18/var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
19/var/www/html/vendor/aws/aws-sdk-php/src/functions.php
20/var/www/html/apps/frontend/config/config.php
21/var/www/html/apps/frontend/library/Tidy/Tidy.php
22/var/www/html/apps/frontend/controllers/IndexController.php
23/var/www/html/apps/frontend/controllers/ControllerBase.php
24/var/www/html/apps/frontend/library/Lang/Lang.php
25/var/www/html/apps/frontend/library/Acl/Acl.php
26/var/www/html/apps/frontend/models/Hierarchy.php
27/var/www/html/apps/frontend/library/Prepare/Prepare.php
28/var/www/html/apps/frontend/models/Content.php
29/var/www/html/apps/frontend/cache/metaData/map-frontend_models_content.php
30/var/www/html/apps/frontend/cache/metaData/meta-frontend_models_content-tbl_content.php
Memory
Usage2097152