Phalcon Framework 5.8.0

Error: Typed property Actiage\Front\Controller\BaseController::$user must not be accessed before initialization

/var/www/html/actiage/releases/20250529130127/src/front/Controller/Appointment/AppointmentsIndexGetController.php (151)
#0Actiage\Front\Controller\Appointment\AppointmentsIndexGetController->checkAllData
/var/www/html/actiage/releases/20250529130127/src/front/Controller/Appointment/AppointmentsIndexGetController.php (48)
<?php
 
namespace Actiage\Front\Controller\Appointment;
 
use Actiage\Front\Controller\BaseController;
use Actiage\Shared\Lib\Consult\ConsultType;
use Actiage\Shared\Lib\Utils\Cookie;
use Actiage\Shared\Lib\Utils\Country;
use Actiage\Shared\Lib\Utils\Genders;
use Actiage\Shared\Lib\Utils\Secure;
use Actiage\Shared\Models\ConsultasCitas;
use Actiage\Shared\Models\ConsultasUsuariosHorasCita;
use Actiage\Shared\Models\ConsultasUsuariosReviews;
use Actiage\Shared\Models\Paises;
use Actiage\Shared\Models\Provincias;
use Actiage\Shared\Models\Usuarios;
use Phalcon\Html\Escaper;
use Phalcon\Html\Helper\Input\Select;
 
/**
 * Class AppointmentsIndexGetController
 */
final class AppointmentsIndexGetController extends BaseController
{
 
    public function initialize()
    {
        $this->jsFiles = [
            'js/consults/common.js',
            'js/shop/star-rating.js',
            'js/validation/jquery.validate.min.js',
            'js/validation/additional-methods.min.js',
            'js/validation/custom-methods.js',
            'js/validation/localization/messages_es.min.js',
            'js/validation/form-edit-data-popup-validation.js',
            'js/country.js'
        ];
        parent::initialize();
    }
 
 
    /**
     * Listado de consultas médicas disponibles
     * @return void
     */
    public function indexAction(): void
    {
        $this->view->userDataCompleted = $this->checkAllData();
        if (!empty($this->user) && !$this->view->userDataCompleted) {
            $this->setUserDataModal();
        }
 
        $freeAppointmentAvailable = true;
        if (isset($this->user['id'])) {
            $freeAppointmentId = $this->AppointmentsPlugin->getFreeAppointmentId(Cookie::getCountry());
            $freeAppointmentAvailable = ConsultasUsuariosHorasCita::freeAppointmentAvailable($this->user['id'], $freeAppointmentId);
        }
 
        $treatments = [];
        $treatmentsCompact = [];
        $othersAppointments = [];
        $evaluationsHealth = [];
 
        $consults = ConsultasCitas::find(['conditions' => 'activo = 1 AND pais = "' . Cookie::getCountryNav() . '"', 'order' => 'orden'])->toArray();
        foreach ($consults as $key => $consult) {
            if (empty($consults[$key]['imagen'])) {
                $consults[$key]['imagen'] = '/img/common/consulta-generica-local.jpg';
            }
            if (!$freeAppointmentAvailable && $consults[$key]['id'] == $freeAppointmentId) {
                unset($consults[$key]);
            } else {
                $consults[$key]['precio'] = round($consult['precio']) . ' ' . $consult['currency'];
                $consults[$key]['tiempo_cita'] = (empty($consult['tiempo_cita'])) ? 'Depende de cada sesión' : $consult['tiempo_cita'] . ' "';
            }
            if ($consult['consulta_cita_tipo_id'] == ConsultType::SESSIONS_ID && $consult['es_analisis'] == 0) {
                $treatments[$key] = $consults[$key];
            } elseif ($consult['consulta_cita_tipo_id'] == ConsultType::SESSIONS_ID && $consult['es_analisis'] == 1) {
                $evaluationsHealth[$key] = $consults[$key];
            } elseif (isset($consults[$key])) {
                $othersAppointments[$key] = $consults[$key];
            }
        }
 
        $this->view->treatments = $treatments;
        $this->view->othersAppointments = $othersAppointments;
        $this->view->evaluationsHealth = $evaluationsHealth;
        $this->view->titleSeo = 'Consultas médicas antienvejecimiento';
        $this->view->descriptionSeo = 'Consultas médicas antienvejecimiento';
        $this->view->classSpecialLayout = 'home-citas';
        $this->view->whatsapp = true;
        $this->view->language = Cookie::getLang();
        $countryCookie = Cookie::getCountryNav();
        if ($countryCookie != Country::SPAIN) {
            $this->view->urlCanonical = DOMINIO . str_replace('-' . $countryCookie, '', $_SERVER['REQUEST_URI']);
        }
        $this->setReviews('', 'consultas');
        $this->view->pick('appointment/index');
    }
 
    /**
     * Comprobar que la url coincide con el pais
     * @return void
     */
    private function checkCountryUrl()
    {
        $country = Cookie::getCountryNav();
 
        if ($country == Country::SPAIN) {
            $this->response->redirect('/es/consultas-medicas-antienvejecimiento')->send();
        } elseif ($country == Country::UNITED_STATES || $country == Country::ALL) {
            $this->response->redirect('/en/anti-aging-medical-consultations')->send();
        }
 
    }
 
    /**
     * @param string $consultId
     * @param string $source
     * @return void
     */
    private function setReviews(string $consultId = '', string $source = ''): void
    {
        if (!empty($consultId)) {
            $params['conditions'] = 'activo = 1 AND consultas_citas_id = ' . $consultId;
        } elseif ($source == 'consultas') {
            $params['conditions'] = 'activo = 1 AND consultas_citas_id IS NOT NULL';
        } else {
            $params['conditions'] = 'activo = 1';
        }
 
        $params['limit'] = '3';
        $params['order'] = 'id DESC';
        $this->view->reviews = ConsultasUsuariosReviews::find($params);
        //$this->view->showFontAwesomeRating = true;
 
        $paramsConsultas['conditions'] = 'activo = 1';
        $paramsConsultas['order'] = 'orden';
        $consults = ConsultasCitas::find($paramsConsultas);
        $consultsList = [];
        foreach ($consults as $consult) {
            $consultsList[$consult->id] = $consult->nombre;
        }
        $this->view->consultNames = $consultsList;
    }
 
    /**
     * @return bool
     */
    private function checkAllData(): bool
    {
        $user = Usuarios::findFirstById($this->user['id']);
        if ($user) {
 
            if (empty($user->nombre) || empty($user->apellidos) || empty($user->telefono)
                || empty($user->pais_id)
                || (empty($user->provincia_id) && $user->pais_id == Country::ESPANA)
                || empty($user->fecha_nacimiento) || empty($user->dni) || empty($user->direccion)
                || empty($user->cp) || empty($user->localidad)
                || empty($user->genero_id)
            ) {
                return false;
            }
        }
 
        return true;
    }
 
    private function setUserDataModal() {
        $this->view->urlBack = Secure::encrypt('/consultas-medicas-antienvejecimiento');
        $this->view->countries = Paises::find(['order' => 'nombre', 'conditions' => 'activo = 1']);
        $this->view->selectInputCountries = new Select(new Escaper());
        $this->view->selectInputStates  = new Select(new Escaper());
        $this->view->selectInputGenders = new Select(new Escaper());
        $this->view->selectInputBirthDays  = new Select(new Escaper());
        $this->view->selectInputBirthMonths  = new Select(new Escaper());
        $this->view->selectInputBirthYears  = new Select(new Escaper());
        $this->view->birthDay = '';
        $this->view->birthMonth = '';
        $this->view->birthYear = '';
 
        $errors = [];
        $user = Usuarios::findFirst($this->user['id']);
 
        if (empty($user->pais_id)) {
            $this->view->states = Provincias::find(['conditions' => 'pais_id = ' . Country::ESPANA, 'order' => 'provincia']);
        } else {
            $this->view->states = Provincias::find(['conditions' => 'pais_id = ' . $user->pais_id, 'order' => 'provincia']);
        }
 
 
        if (!empty($user->fecha_nacimiento)) {
            $date = explode('-', $user->fecha_nacimiento);
            if (isset($date[2])) {
                $this->view->birthDay = ltrim($date[2], '0') ?? '';
            }
            if (isset($date[1])) {
                $this->view->birthMonth = ltrim($date[1], '0') ?? '';
            }
            if (isset($date[0])) {
                $this->view->birthYear = $date[0] ?? '';
            }
        }
 
 
        $this->view->birthDays = $this->CalendarPlugin->getDays();
        $this->view->birthMonths = $this->CalendarPlugin->getMonths();
        $this->view->birthYears = $this->CalendarPlugin->getYears();
        $this->view->genders = Genders::findMin();
        $this->view->user = $user;
        $this->view->errors = $errors;
    }
 
}
#1Actiage\Front\Controller\Appointment\AppointmentsIndexGetController->indexAction
#2Phalcon\Dispatcher\AbstractDispatcher->callActionMethod
#3Phalcon\Dispatcher\AbstractDispatcher->dispatch
#4Phalcon\Mvc\Application->handle
/var/www/html/actiage/releases/20250529130127/public/index.php (88)
<?php
use Phalcon\Di\FactoryDefault;
use Phalcon\Logger\AbstractLogger;
use Phalcon\Logger\Adapter\Stream;
use Phalcon\Logger\Logger;
use Phalcon\Mvc\Application;
use Phalcon\Support\Debug;
 
$debug = new Debug();
$debug->listen();
 
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/src');
 
/**
 * The FactoryDefault Dependency Injector automatically registers
 * the services that provide a full stack framework.
 */
$di = new FactoryDefault();
 
/**
 * Entornos de desarrollo disponibles y variables de entorno
 */
require_once APP_PATH . '/config/environment.php';
 
if (ENVIRONMENT == 'development') {
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
}
 
/**
 * Información listas en klaviyo
 */
require_once APP_PATH . '/config/klaviyo.php';
 
/**
 * Read services
 */
require_once APP_PATH . '/config/services.php';
 
/**
 * Handle routes
 */
require_once APP_PATH . '/config/router.php';
 
/**
 * Get config service for use in inline setup below
 */
$config = $di->get('config');
 
/**
 * Include Autoloader
 */
require_once APP_PATH . '/config/loader.php';
 
 
/**
 * Handle the request
 */
$application = new Application($di);
 
$application->registerModules(
    [
        'admin' => [
            'className' => Actiage\Admin\Module::class,
            'path'      => '../src/admin/Module.php',
        ],
        'doctor'  => [
            'className' => Actiage\Doctor\Module::class,
            'path'      => '../src/doctor/Module.php',
        ],
        'sponsor'  => [
            'className' => Actiage\Sponsor\Module::class,
            'path'      => '../src/sponsor/Module.php',
        ],
        'user'  => [
            'className' => Actiage\User\Module::class,
            'path'      => '../src/user/Module.php',
        ],
        'front'  => [
            'className' => Actiage\Front\Module::class,
            'path'      => '../src/front/Module.php',
        ]
    ]
);
 try {
    if(ENVIRONMENT != DEVELOPMENT) {
        echo str_replace(['\n', '\r', '\t'], '', $application->handle($_SERVER['REQUEST_URI'])->getContent());
    } else {
        echo $application->handle($_SERVER['REQUEST_URI'])->getContent();
    }
 } catch (\Exception $e) {
    $debugFile = new Stream(BASE_PATH . '/tmp/logs/error.log');
 
    $message = get_class($e) . ': ' . $e->getMessage() . '\n' . ' File=' . $e->getFile() . '\n' . ' Line=' . $e->getLine() . '\n' . $e->getTraceAsString() . '\n';
    $message .= $_SERVER['REQUEST_URI'] . '\n';
    $logger = new Logger('errorLog', ['main' => $debugFile]);
    $logger->log(AbstractLogger::CRITICAL,$message);
    $debugFile->close();
}
 
KeyValue
_url/consultas-medicas-antienvejecimiento
KeyValue
USERnginx
HOME/var/lib/nginx
HTTP_ACCEPT_ENCODINGgzip, br, zstd, deflate
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT*/*
HTTP_HOSTactiage.es
REDIRECT_STATUS200
SERVER_NAMEactiage.es
SERVER_PORT443
SERVER_ADDR51.77.247.31
REMOTE_PORT36230
REMOTE_ADDR216.73.216.38
SERVER_SOFTWAREnginx/1.20.1
GATEWAY_INTERFACECGI/1.1
HTTPSon
REQUEST_SCHEMEhttps
SERVER_PROTOCOLHTTP/2.0
DOCUMENT_ROOT/var/www/html/actiage/current/public
DOCUMENT_URI/index.php
REQUEST_URI/consultas-medicas-antienvejecimiento
SCRIPT_NAME/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHODGET
QUERY_STRING_url=/consultas-medicas-antienvejecimiento&
SCRIPT_FILENAME/var/www/html/actiage/current/public/index.php
APPLICATION_ENVproduction
FCGI_ROLERESPONDER
PHP_SELF/index.php
REQUEST_TIME_FLOAT1748624612.1348
REQUEST_TIME1748624612
#Path
0/var/www/html/actiage/releases/20250529130127/public/index.php
1/var/www/html/actiage/shared/environment.php
2/var/www/html/actiage/shared/klaviyo.php
3/var/www/html/actiage/releases/20250529130127/src/config/services.php
4/var/www/html/actiage/releases/20250529130127/src/config/router.php
5/var/www/html/actiage/releases/20250529130127/src/front/router.php
6/var/www/html/actiage/releases/20250529130127/src/admin/router.php
7/var/www/html/actiage/releases/20250529130127/src/doctor/router.php
8/var/www/html/actiage/releases/20250529130127/src/user/router.php
9/var/www/html/actiage/releases/20250529130127/src/sponsor/router.php
10/var/www/html/actiage/shared/config.php
11/var/www/html/actiage/releases/20250529130127/src/config/loader.php
12/var/www/html/actiage/shared/vendor/autoload.php
13/var/www/html/actiage/shared/vendor/composer/autoload_real.php
14/var/www/html/actiage/shared/vendor/composer/platform_check.php
15/var/www/html/actiage/shared/vendor/composer/ClassLoader.php
16/var/www/html/actiage/shared/vendor/composer/autoload_static.php
17/var/www/html/actiage/shared/vendor/symfony/deprecation-contracts/function.php
18/var/www/html/actiage/shared/vendor/symfony/polyfill-mbstring/bootstrap.php
19/var/www/html/actiage/shared/vendor/symfony/polyfill-mbstring/bootstrap80.php
20/var/www/html/actiage/shared/vendor/symfony/polyfill-ctype/bootstrap.php
21/var/www/html/actiage/shared/vendor/symfony/polyfill-ctype/bootstrap80.php
22/var/www/html/actiage/shared/vendor/react/promise/src/functions_include.php
23/var/www/html/actiage/shared/vendor/react/promise/src/functions.php
24/var/www/html/actiage/shared/vendor/cakephp/core/functions.php
25/var/www/html/actiage/shared/vendor/ralouphie/getallheaders/src/getallheaders.php
26/var/www/html/actiage/shared/vendor/symfony/polyfill-intl-grapheme/bootstrap.php
27/var/www/html/actiage/shared/vendor/symfony/polyfill-intl-normalizer/bootstrap.php
28/var/www/html/actiage/shared/vendor/symfony/polyfill-intl-normalizer/bootstrap80.php
29/var/www/html/actiage/shared/vendor/symfony/string/Resources/functions.php
30/var/www/html/actiage/shared/vendor/symfony/polyfill-php80/bootstrap.php
31/var/www/html/actiage/shared/vendor/cakephp/utility/bootstrap.php
32/var/www/html/actiage/shared/vendor/cakephp/utility/Inflector.php
33/var/www/html/actiage/shared/vendor/guzzlehttp/guzzle/src/functions_include.php
34/var/www/html/actiage/shared/vendor/guzzlehttp/guzzle/src/functions.php
35/var/www/html/actiage/shared/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php
36/var/www/html/actiage/shared/vendor/symfony/polyfill-php81/bootstrap.php
37/var/www/html/actiage/shared/vendor/digitalbazaar/json-ld/jsonld.php
38/var/www/html/actiage/shared/vendor/ezyang/htmlpurifier/library/HTMLPurifier.composer.php
39/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/_bootstrap.php
40/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/all.php
41/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/any.php
42/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/apply.php
43/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/assoc.php
44/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/butlast.php
45/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/complement.php
46/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/compose.php
47/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/constant.php
48/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/dissoc.php
49/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/do_if.php
50/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/each.php
51/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/filter.php
52/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/filter_fresh.php
53/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/filter_null.php
54/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/first.php
55/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/flat_map.php
56/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/flatten.php
57/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/get.php
58/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/get_each.php
59/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/get_in.php
60/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/group_by.php
61/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/key.php
62/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/identity.php
63/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/instance_of.php
64/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/last.php
65/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/map.php
66/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/memoize.php
67/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/not.php
68/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/partial.php
69/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/partition.php
70/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/pipe.php
71/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/reduce.php
72/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/reindex.php
73/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/repeat.php
74/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/rest.php
75/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/reverse.php
76/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/search.php
77/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/some.php
78/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/sort.php
79/var/www/html/actiage/shared/vendor/lambdish/phunctional/src/to_array.php
80/var/www/html/actiage/shared/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php
81/var/www/html/actiage/shared/vendor/ramsey/uuid/src/functions.php
82/var/www/html/actiage/shared/vendor/symfony/var-dumper/Resources/functions/dump.php
83/var/www/html/actiage/releases/20250529130127/src/front/Module.php
84/var/www/html/actiage/releases/20250529130127/src/front/Controller/Appointment/AppointmentsIndexGetController.php
85/var/www/html/actiage/releases/20250529130127/src/front/Controller/BaseController.php
86/var/www/html/actiage/releases/20250529130127/src/Shared/plugins/TimeZonePlugin.php
87/var/www/html/actiage/releases/20250529130127/src/middleware/MiddleWareView.php
88/var/www/html/actiage/shared/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php
89/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Device.php
90/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Cookie.php
91/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Country.php
92/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Ip.php
93/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Slug.php
94/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Currency.php
95/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Bot.php
96/var/www/html/actiage/releases/20250529130127/src/Shared/plugins/RobotsPlugin.php
97/var/www/html/actiage/releases/20250529130127/src/Shared/plugins/RedisPlugin.php
98/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/Image.php
99/var/www/html/actiage/releases/20250529130127/src/Shared/plugins/JsPlugin.php
100/var/www/html/actiage/shared/vendor/matthiasmullie/minify/src/JS.php
101/var/www/html/actiage/shared/vendor/matthiasmullie/minify/src/Minify.php
102/var/www/html/actiage/releases/20250529130127/src/Shared/plugins/CssPlugin.php
103/var/www/html/actiage/releases/20250529130127/src/Shared/library/User/UserRole.php
104/var/www/html/actiage/releases/20250529130127/src/Shared/library/Utils/MenuNav.php
105/var/www/html/actiage/releases/20250529130127/src/Shared/models/Provincias.php
106/var/www/html/actiage/releases/20250529130127/src/Shared/models/ModelBase.php
107/var/www/html/actiage/releases/20250529130127/src/Shared/plugins/SeoPlugin.php
108/var/www/html/actiage/releases/20250529130127/src/Shared/models/SemaforoCritical.php
109/var/www/html/actiage/releases/20250529130127/src/Shared/models/Usuarios.php
Memory
Usage2097152