Phalcon Framework 5.8.0

TypeError: Actiage\Front\Controller\Appointment\AppointmentsViewGetController::setReviews(): Argument #1 ($consultId) must be of type string, null given, called in /var/www/html/actiage/releases/20250613143808/src/front/Controller/Appointment/AppointmentsViewGetController.php on line 68

/var/www/html/actiage/releases/20250613143808/src/front/Controller/Appointment/AppointmentsViewGetController.php (109)
#0Actiage\Front\Controller\Appointment\AppointmentsViewGetController->setReviews
/var/www/html/actiage/releases/20250613143808/src/front/Controller/Appointment/AppointmentsViewGetController.php (68)
  1. <?php
  2.  
  3. namespace Actiage\Front\Controller\Appointment;
  4.  
  5. use Actiage\Front\Controller\BaseController;
  6. use Actiage\Shared\Infrastructure\Modules\ConsultsAppointments\ConsultsAppointmentsGetBySlug;
  7. use Actiage\Shared\Lib\Utils\Cookie;
  8. use Actiage\Shared\Lib\Utils\Country;
  9. use Actiage\Shared\Lib\Utils\Genders;
  10. use Actiage\Shared\Lib\Utils\Language;
  11. use Actiage\Shared\Lib\Utils\Secure;
  12. use Actiage\Shared\Models\ConsultasCitas;
  13. use Actiage\Shared\Models\ConsultasUsuariosReviews;
  14. use Actiage\Shared\Models\Paises;
  15. use Actiage\Shared\Models\Provincias;
  16. use Actiage\Shared\Models\Usuarios;
  17. use Phalcon\Html\Escaper;
  18. use Phalcon\Html\Helper\Input\Select;
  19.  
  20. /**
  21. * Class AppointmentsViewGetController
  22. */
  23. final class AppointmentsViewGetController extends BaseController
  24. {
  25.  
  26. private $slug;
  27. public function initialize()
  28. {
  29. $this->jsFiles = [
  30. 'js/shop/star-rating.js',
  31. 'js/country.js',
  32. ];
  33. parent::initialize();
  34. }
  35. /**
  36. * Vemos más a fondo el tipo de consulta que es
  37. * @param string $slug
  38. * @return void
  39. */
  40. public function viewAction(string $slug = '')
  41. {
  42. if (empty($slug)) {
  43. $this->throw404();
  44. }
  45. $this->slug = $slug;
  46. $this->view->userDataCompleted = $this->checkAllData();
  47. if (!empty($this->user) && !$this->view->userDataCompleted) {
  48. $this->setUserDataModal();
  49. }
  50. $consult = (new ConsultsAppointmentsGetBySlug())->get($slug)->toArray();
  51.  
  52. if (!$consult) {
  53. $this->throw404();
  54. }
  55.  
  56. $country = Cookie::getCountry();
  57. if ($country == Country::UNITED_STATES) {
  58. $path = Language::ENGLISH;
  59. } elseif ($country == Country::SPAIN) {
  60. $path = Language::SPANISH;
  61. } else {
  62. $path = Language::ENGLISH;
  63. }
  64. $this->view->appointmentPath = $path;
  65. $this->view->consult = $consult;
  66. $this->view->titleSeo = $consult[0]['ConsultasCitas']->nombre;
  67. $this->view->descriptionSeo = $consult[0]['ConsultasCitas']->nombre;
  68. $this->setReviews($consult[0]['ConsultasCitas']->id);
  69. $this->view->classSpecialLayout = 'ficha-cita';
  70. $countryCookie = Cookie::getCountryNav();
  71. if ($countryCookie != Country::SPAIN) {
  72. $this->view->urlCanonical = DOMINIO . str_replace('-' . $countryCookie, '', $_SERVER['REQUEST_URI']);
  73. }
  74. $this->view->language = Cookie::getLang();
  75. $this->view->whatsapp = true;
  76. $this->assets->addJs('/js/general-consults.js');
  77. $this->view->blank = true;
  78. $this->view->containerDiv = '1s';
  79. if ($slug !== 'consulta-de-50-minutos') {
  80. $this->view->treatment = '-tratamiento';
  81. } else {
  82. $this->view->treatment = '';
  83. }
  84.  
  85.  
  86. $this->view->pick('appointment/view');
  87. }
  88.  
  89. /**
  90. * Comprobar que la url coincide con el pais
  91. * @param string $slug
  92. * @return void
  93. */
  94. private function checkUrlCountry(string $slug = '')
  95. {
  96. $country = Cookie::getCountryNav();
  97. if ($country == Country::UNITED_STATES || $country == Country::ALL) {
  98. $this->response->redirect('/en/anti-aging-medical-consultations/' . $slug)->send();
  99. } elseif ($country == Country::SPAIN) {
  100. $this->response->redirect('/es/consultas-medicas-antienvejecimiento/' . $slug)->send();
  101. }
  102. }
  103.  
  104. /**
  105. * @param string $consultId
  106. * @param string $source
  107. * @return void
  108. */
  109. private function setReviews(string $consultId = '', string $source = ''): void
  110. {
  111. if (!empty($consultId)) {
  112. $params['conditions'] = 'activo = 1 AND consultas_citas_id = ' . $consultId;
  113. } elseif ($source == 'consultas') {
  114. $params['conditions'] = 'activo = 1 AND consultas_citas_id IS NOT NULL';
  115. } else {
  116. $params['conditions'] = 'activo = 1';
  117. }
  118.  
  119. $params['limit'] = '3';
  120. $params['order'] = 'id DESC';
  121. $this->view->reviews = ConsultasUsuariosReviews::find($params);
  122. // $this->view->showFontAwesomeRating = true;
  123.  
  124. $paramsConsultas['conditions'] = 'activo = 1';
  125. $paramsConsultas['order'] = 'orden';
  126. $consults = ConsultasCitas::find($paramsConsultas);
  127. $consultList = [];
  128. foreach ($consults as $consult) {
  129. $consultList[$consult->id] = $consult->nombre;
  130. }
  131. $this->view->consultNames = $consultList;
  132. }
  133.  
  134. /**
  135. * @return bool
  136. */
  137. private function checkAllData(): bool
  138. {
  139. if (empty($this->user['id'])) {
  140. return true;
  141. }
  142. $user = Usuarios::findFirstById($this->user['id']);
  143. if ($user) {
  144.  
  145. if (empty($user->nombre) || empty($user->apellidos) || empty($user->telefono)
  146. || empty($user->pais_id)
  147. || (empty($user->provincia_id) && $user->pais_id == Country::ESPANA)
  148. || empty($user->fecha_nacimiento) || empty($user->dni) || empty($user->direccion)
  149. || empty($user->cp) || empty($user->localidad)
  150. || empty($user->genero_id)
  151. ) {
  152. return false;
  153. }
  154. }
  155.  
  156. return true;
  157. }
  158.  
  159. private function setUserDataModal() {
  160.  
  161. $this->view->urlBack = Secure::encrypt('/consultas-medicas-antienvejecimiento/' . $this->slug);
  162. $this->view->countries = Paises::find(['order' => 'nombre', 'conditions' => 'activo = 1']);
  163. $this->view->selectInputCountries = new Select(new Escaper());
  164. $this->view->selectInputStates = new Select(new Escaper());
  165. $this->view->selectInputGenders = new Select(new Escaper());
  166. $this->view->selectInputBirthDays = new Select(new Escaper());
  167. $this->view->selectInputBirthMonths = new Select(new Escaper());
  168. $this->view->selectInputBirthYears = new Select(new Escaper());
  169. $this->view->birthDay = '';
  170. $this->view->birthMonth = '';
  171. $this->view->birthYear = '';
  172.  
  173. $errors = [];
  174. $user = Usuarios::findFirst($this->user['id']);
  175.  
  176. if (empty($user->pais_id)) {
  177. $this->view->states = Provincias::find(['conditions' => 'pais_id = ' . Country::ESPANA, 'order' => 'provincia']);
  178. } else {
  179. $this->view->states = Provincias::find(['conditions' => 'pais_id = ' . $user->pais_id, 'order' => 'provincia']);
  180. }
  181.  
  182. if (!empty($user->fecha_nacimiento)) {
  183. $date = explode('-', $user->fecha_nacimiento);
  184. if (isset($date[2])) {
  185. $this->view->birthDay = ltrim($date[2], '0') ?? '';
  186. }
  187. if (isset($date[1])) {
  188. $this->view->birthMonth = ltrim($date[1], '0') ?? '';
  189. }
  190. if (isset($date[0])) {
  191. $this->view->birthYear = $date[0] ?? '';
  192. }
  193. }
  194. $this->view->birthDays = $this->CalendarPlugin->getDays();
  195. $this->view->birthMonths = $this->CalendarPlugin->getMonths();
  196. $this->view->birthYears = $this->CalendarPlugin->getYears();
  197. if (empty($user->pais_id)) {
  198. $this->view->states = Provincias::find(['conditions' => 'pais_id = ' . Country::ESPANA, 'order' => 'provincia']);
  199. } else {
  200. $this->view->states = Provincias::find(['conditions' => 'pais_id = ' . $user->pais_id, 'order' => 'provincia']);
  201. }
  202. $this->view->genders = Genders::findMin();
  203.  
  204. $this->view->user = $user;
  205. $this->view->errors = $errors;
  206. }
  207.  
  208. }
#1Actiage\Front\Controller\Appointment\AppointmentsViewGetController->viewAction
#2Phalcon\Dispatcher\AbstractDispatcher->callActionMethod
#3Phalcon\Dispatcher\AbstractDispatcher->dispatch
#4Phalcon\Mvc\Application->handle
/var/www/html/actiage/releases/20250613143808/public/index.php (88)
  1. <?php
  2. use Phalcon\Di\FactoryDefault;
  3. use Phalcon\Logger\AbstractLogger;
  4. use Phalcon\Logger\Adapter\Stream;
  5. use Phalcon\Logger\Logger;
  6. use Phalcon\Mvc\Application;
  7. use Phalcon\Support\Debug;
  8.  
  9. $debug = new Debug();
  10. $debug->listen();
  11.  
  12. define('BASE_PATH', dirname(__DIR__));
  13. define('APP_PATH', BASE_PATH . '/src');
  14.  
  15. /**
  16. * The FactoryDefault Dependency Injector automatically registers
  17. * the services that provide a full stack framework.
  18. */
  19. $di = new FactoryDefault();
  20.  
  21. /**
  22. * Entornos de desarrollo disponibles y variables de entorno
  23. */
  24. require_once APP_PATH . '/config/environment.php';
  25.  
  26. if (ENVIRONMENT == 'development') {
  27. ini_set('display_errors', 1);
  28. error_reporting(E_ALL);
  29. }
  30.  
  31. /**
  32. * Información listas en klaviyo
  33. */
  34. require_once APP_PATH . '/config/klaviyo.php';
  35.  
  36. /**
  37. * Read services
  38. */
  39. require_once APP_PATH . '/config/services.php';
  40.  
  41. /**
  42. * Handle routes
  43. */
  44. require_once APP_PATH . '/config/router.php';
  45.  
  46. /**
  47. * Get config service for use in inline setup below
  48. */
  49. $config = $di->get('config');
  50.  
  51. /**
  52. * Include Autoloader
  53. */
  54. require_once APP_PATH . '/config/loader.php';
  55.  
  56.  
  57. /**
  58. * Handle the request
  59. */
  60. $application = new Application($di);
  61.  
  62. $application->registerModules(
  63. [
  64. 'admin' => [
  65. 'className' => Actiage\Admin\Module::class,
  66. 'path' => '../src/admin/Module.php',
  67. ],
  68. 'doctor' => [
  69. 'className' => Actiage\Doctor\Module::class,
  70. 'path' => '../src/doctor/Module.php',
  71. ],
  72. 'sponsor' => [
  73. 'className' => Actiage\Sponsor\Module::class,
  74. 'path' => '../src/sponsor/Module.php',
  75. ],
  76. 'user' => [
  77. 'className' => Actiage\User\Module::class,
  78. 'path' => '../src/user/Module.php',
  79. ],
  80. 'front' => [
  81. 'className' => Actiage\Front\Module::class,
  82. 'path' => '../src/front/Module.php',
  83. ]
  84. ]
  85. );
  86. try {
  87. if(ENVIRONMENT != DEVELOPMENT) {
  88. echo str_replace(['\n', '\r', '\t'], '', $application->handle($_SERVER['REQUEST_URI'])->getContent());
  89. } else {
  90. echo $application->handle($_SERVER['REQUEST_URI'])->getContent();
  91. }
  92. } catch (\Exception $e) {
  93. $debugFile = new Stream(BASE_PATH . '/tmp/logs/error.log');
  94.  
  95. $message = get_class($e) . ': ' . $e->getMessage() . '\n' . ' File=' . $e->getFile() . '\n' . ' Line=' . $e->getLine() . '\n' . $e->getTraceAsString() . '\n';
  96. $message .= $_SERVER['REQUEST_URI'] . '\n';
  97. $logger = new Logger('errorLog', ['main' => $debugFile]);
  98. $logger->log(AbstractLogger::CRITICAL,$message);
  99. $debugFile->close();
  100. }
  101.