Magento 2.2 – Fatal error: Uncaught Error: Call to undefined method Magento\Framework\App\ResourceConnection::load()

Fatal error: Uncaught Error: Call to undefined method Magento\Framework\App\ResourceConnection::load() in /var/www/html/magento2_dev/vendor/magento/framework/Model/AbstractModel.php:536

Just adding the resource connection on my extended Sales Model, getting the above issue.

Below is my code:

<?php namespace Sdi\Sales\Model; use Magento\Framework\App\Request\DataPersistorInterface; class Order extends \Magento\Sales\Model\Order {    protected $  _resource;    public function __construct(         \Magento\Framework\App\ResourceConnection $  resource ) {     $  this->_resource = $  resource; } public function bnDelete() {     if ($  this->getStatus() == Mage_Sales_Model_Order::STATE_CANCELED) {         $  connection = $  this->_resource->getConnection(\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION);         $  query = 'SQL QUERY';         $  connection->query($  query);     }     return false; } } 

SP.CamlQuery().set_viewXml() returns undefined

I am trying to run a CAML query to sort through some data. Once the page finishes loading i do not get the results i want. I checked the functions and it turns out that for some reason, my CAML query returns undefined. It only does this after it is passed in the set_viewXml() function. Code provided below:

var runQuery = function (dateObj, query, success, failure, context) {     var camlQuery = new SP.CamlQuery();     alert(query); // shows the CAML query    alert(camlQuery.set_viewXml(query(dateObj))); // shows me undefined     camlQuery.set_viewXml(query(dateObj));     items = list.getItems(camlQuery);     context.load(items);     context.executeQueryAsync(success, failure); }; 

Here is the CAML:

"<View>" +     "<Query>" +       "<Where>" +           "<And>" +             "<Eq>" +                "<FieldRef Name='EventStartDate' />" +                "<Value Type='DateTime' IncludeTimeValue='FALSE'>" +                   dateObj.toISOString() +                "</Value>" +             "</Eq>" +             "<Eq><FieldRef Name=\"QueryID\" /><Value Type=\"Text\">2216</Value></Eq>" +          "</And>" +       "</Where>" +       "<GroupBy><FieldRef Name='EventName'></FieldRef></GroupBy>"+       "<OrderBy><FieldRef Name='EventStartDate' /><FieldRef Name='EventEndDate' /><FieldRef Name='EventName' /></OrderBy>" +    "</Query>" + "</View>"; 

I am pretty sure there is something wrong with the CAML query because i do not work with it on a day to day basis.

I have this code running fine in another app and when I alert(alert(camlQuery.set_viewXml(query(dateObj)));) I am able to see the full CAML query build (it does not return undefined). Not sure if that helps any.

How to fix ajax call to get user id returns undefined if same url works directly in browser?

I have an array with a few user email addresses in it, trying to iterate through the array and get Ids. Console log is telling me xuser is undefined.

When I manually enter the url below into the browser with an email from the array I get the desired xml result, with users id.

EmailArray.forEach(GetUserId);  function GetUserId(item) {    console.log(item);   $  .ajax({      url: xhost + "/portal/_api/web/SiteUsers?$  select=Id&$  filter=Email eq '" + item + "'",     type: "GET", headers: { "Accept": "application/json;odata=verbose", },     success: function (data) {       var xuser = data.d.Id;       console.log(xuser);     },     error: function (error) { alert(JSON.stringify(error)); }   }); } 


Notice: Undefined index: magento_eav_attribute_set in/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 152

bin/magento setup:upgrade   Notice: Undefined index: magento_eav_attribute_set in /vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 152 

If I understand correctly this is about missing a table in database, but how to check if we have some application that can use it, because honestly I don’t know how to look for it or how this table should look like.

Oh yes, we did setup:di:compile and reindex, nothing helps

TypeError: Cannot read property ‘style’ of undefined в слайдере

В слайдере выходит ошибка TypeError: Cannot read property ‘style’ of undefined после первой смены блока. Класс active добавляется только первый раз.

<div class="page-8__info slides">         <div class="page-8__text">             <h4>Низкий уровень шума</h4>             <p>Низкий уровень шума от 20 Дб <br>приточно-очистительного комплекса                  BREZZA RCB 150 обеспечивает комфортное использование прибора в офисе, коттедже,                  квартире, а также в спальне и детской комнате.</p>             <img src="img/sound 1.png" alt="">             <img src="img/sound 2.png" alt="">             <div class="dots-container">                 <div class="dot"></div>                 <div class="dot"></div>             </div>         </div>     </div>     <div class="page-8__info-2 slides">         <div class="page-8__text-2">             <h4>Низкий уровень шума</h4>             <p>Низкий уровень шума от 20 Дб <br>приточно-очистительного комплекса                  BREZZA RCB 150 обеспечивает комфортное использование прибора в офисе, коттедже,                  квартире, а также в спальне и детской комнате.</p>             <img src="img/sound 1.png" alt="">             <img src="img/sound 2.png" alt="">             <div class="dots-container">                 <div class="dot"></div>                 <div class="dot"></div>             </div>         </div>     </div>   Script  let slideIndex = 0;  let showSlides = () => {      let slides = document.querySelectorAll('.slides');     let dots = document.querySelectorAll('.dot');      for (let i = 0; i < slides.length; i++) {         slides[i].style.display = 'none';     }      slideIndex++;      if (slideIndex < slides.length) {         slideIndex = 1;     }      for (let i = 0; i < dots.length; i++) {         dots[i].className = dots[i].className.replace(' active', '');     }      slides[slideIndex - 1].style.display = 'block';     dots[slideIndex - 1].className += ' active';     setTimeout( showSlides, 2000);  }  showSlides(); 

При рандомном выборе из массива иногда выводит undefined

let firstWord = ['Анальный','Глистовый','Ректальный','Мочевой','Говнососный','Спермосмоктовый','Гниложопый','Маслорожий','Сперможопый','Мочелицый','Говнолицый','Спермолицый','Жопноспидный','Гейниггерский','Куколдский','Попущеный','Геймасловый','Рыбнокаловый','Сельдевый','Камбалообразный','Китовоанальный','Спермоедный','Сосательный','Лизательный','Каловомассовый','Пидорский','Жопный','Вонючий','Гнилозубый','Маслососовый','Смегмоглотовый','Яйцекусовый','Дерьмомордый','Спермоглазый','Прыгучий','Залупный','Адский','Гитлеровый','Армянский','Яйцеголовый','Смегмоподбородочный','Бородавочный','Раковый','Слюнявый','Сопливый','Слизнявый','Обоссаный спермоуриной','Обрыганный калом','Измазанный спермой','Обсосасный смегмой']; let secondWord = ['Мочевик','Гавносос','Педик','Геймасло','Слизняк','Говноплюй','Спермоглот','Говнорот','Маслохлёб','Дрочмейстер','Сальник','Жировик','Гнойник','Гной','Спермопрыщ','Жопонюх','Очколаз','Каломразь','Геморойник','Мухомор','Гнилец','Утопец','Сосальник','Жмыхон','Коксакер','Куколдсакер','Павук','Аналжук','Сперможук','Яйценюх','Анусогниль','Жопочервь','Уретрич','Уриныч','Сосич','Какич','Пукич','Яичич','Залупыч','Говноедыч','Гнилочервич','Попущеныч','Салопаук','Маслолаз','Мочаговно','Спермослив','Спермобочка','Басссперма','Говнодырка','Мочедырка'];  function roll() {   let rollRole = Math.round((Math.random(0, 0.5) * 100));   let rollRole1 = Math.round((Math.random(0, 0.5) * 100));     alert(firstWord[rollRole1] + " " + firstWord[rollRole] + " " + secondWord[rollRole]); }   document.getElementById('rollas').onclick = roll;  

Update fails with undefined function system_rebuild_module_data in but the function is defined in system.module

When I run drush updb on my Drupal 8.3.1 site, I get:

PHP Fatal error: Call to undefined function system_rebuild_module_data() in /var/www/mysite/web/core/includes/ on line 46

system_rebuild_module_data() is defined in web/core/modules/system.module on line 1102.

So I’m guessing this is not a bug in Drupal 8.3.1 given that it has been released; rather it must be something to do with my setup. Perhaps the PHP class autoloader or equivalent isn’t working properly such that the function in system.module is not being made visible to

Can you advise what the root cause might be and how I could overcome this fatal error stopping me running drush updb?

This is my composer.json file.

{   "name": "my-site",   "description": "My Site Website",   "type": "project",   "authors": [     {       "name": "",       "role": ""     }   ],   "repositories": [     {       "type": "composer",       "url": ""     },     {       "type": "composer",       "url": ""     }   ],   "config": {     "preferred-install": "source",     "discard-changes": true   },   "require": {     "composer/installers": "^1.0.20",     "cweagans/composer-patches": "~1.0",     "drupal/core": "8.3.1",     "drush/drush": "8.1.2",     "drupal/migrate_tools": "2.0.0-beta1",     "drupal/migrate_upgrade": "2.0.0-beta1",     "drupal/admin_toolbar": "1.19.0",     "drupal/coder": "8.2.5",     "drupal/libraries": "3.x-dev",     "drupal/pathauto": " 1.0.0",     "drupal/honeypot": "1.24.0",     "drupal/metatag": "1.0.0",     "drupal/mollom": "1.1.0",     "drupal/smtp": "1.0.0-beta2",     "drupal/token": "1.0.0",     "drupal/simple_sitemap": "2.9.0",     "drupal/google_analytics": "2.1.0",     "wkse/google_tag": "8.0.2",     "drupal/video_embed_media": "1.5.0",     "drupal/video_embed_field": "1.5.0",     "drupal/masquerade": "2.0.0-beta1",     "drupal/paragraphs": "1.1.0",     "drupal/slick": "1.0.0-rc3",     "drupal/blazy":"1.0.0-rc1",     "drupal/slick_extras": "1.0.0-beta2",     "drupal/slick_media": "1.0.0-rc1",     "drupal/responsive_menu": "2.4.0",     "drupal/addtoany": "1.8.0",     "drupal/videojs": "1.0.0",     "drupal/redis": "1.0.0-beta1",     "drupal/views_infinite_scroll": "1.3.0",     "drupal/twig_tweak": "1.7.0",     "drupal/maxlength": "1.0.0-beta1",     "drupal/entity": "1.0.0-alpha4",     "drupal/migrate_plus": "3.0.0-beta1",     "drupal/focal_point": "1.0.0-beta4",     "drupal/crop": "1.2.0",     "mollom/client":"dev-psr4",     "drupal/ctools": "3.0.0",     "drupal/superfish": "1.0.0-rc6",     "drupal/devel": "1.0.0-rc2"   },   "require-dev": {     "behat/mink": "~1.6",     "behat/mink-goutte-driver": "~1.2",     "jcalderonzumba/gastonjs": "^1.1@dev",     "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",     "mikey179/vfsStream": "~1.2",     "phpunit/phpunit": "~4.8",     "symfony/css-selector": "2.7.*"   },   "conflict": {     "drupal/drupal": "*"   },   "prefer-stable": true,    "scripts": {     "post-install-cmd": "sh ./scripts/composer/"   },   "extra": {     "installer-paths": {       "web/core": ["type:drupal-core"],       "web/modules/contrib/{$  name}": ["type:drupal-module"],       "web/profiles/contrib/{$  name}": ["type:drupal-profile"],       "web/themes/contrib/{$  name}": ["type:drupal-theme"],       "drush/contrib/{$  name}": ["type:drupal-drush"]     },     "patches": {       "drupal/core": {         "Contextual links broken because of JS error": "web/modules/patches/core-js-fix-contextual.patch",         "Fix quick edit contextual link not available and throwing js error": "web/modules/patches/drupalbehaviorerror.patch"       }     }   } } 

This is the full stack trace that was outputted with the error at the terminal. I have included my Composer, Drush and PHP versions in the output.

[07:56 PM]-[vagrant@redisvmadded]-[/var/www/]-[git mysite_security_updates_apr2017]  $   drush updb The following module is missing from the file system: minimal                                                                                                                                   [warning] PHP Fatal error:  Call to undefined function system_rebuild_module_data() in /var/www/ on line 46 PHP Stack trace: PHP   1. {main}() /var/www/ PHP   2. drush_main() /var/www/ PHP   3. Drush\Boot\BaseBoot->bootstrap_and_dispatch() /var/www/ PHP   4. drush_dispatch() /var/www/ PHP   5. call_user_func_array:{/var/www/}() /var/www/ PHP   6. drush_command() /var/www/ PHP   7. _drush_invoke_hooks() /var/www/ PHP   8. call_user_func_array:{/var/www/}() /var/www/ PHP   9. drush_core_updatedb() /var/www/ PHP  10. update_main() /var/www/ PHP  11. update_fix_compatibility() /var/www/ PHP  12. update_check_incompatibility() /var/www/  Fatal error: Call to undefined function system_rebuild_module_data() in /var/www/ on line 46  Call Stack:     0.0001     224136   1. {main}() /var/www/     0.0018     390448   2. drush_main() /var/www/     0.2686    9406544   3. Drush\Boot\BaseBoot->bootstrap_and_dispatch() /var/www/     0.8071    8732656   4. drush_dispatch() /var/www/     0.9030   11534768   5. call_user_func_array:{/var/www/}() /var/www/     0.9030   11535120   6. drush_command() /var/www/     0.9032   11540088   7. _drush_invoke_hooks() /var/www/     0.9069   11583864   8. call_user_func_array:{/var/www/}() /var/www/     0.9069   11584144   9. drush_core_updatedb() /var/www/     0.9109   11771208  10. update_main() /var/www/     1.9984   26727888  11. update_fix_compatibility() /var/www/     2.0147   26930512  12. update_check_incompatibility() /var/www/  Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                [error] Error: Call to undefined function system_rebuild_module_data() in /var/www/, line 46  [07:56 PM]-[vagrant@redisvmadded]-[/var/www/]-[git mysite_security_updates_apr2017]  $   drush --version  Drush Version   :  8.1.2    [08:13 PM]-[vagrant@redisvmadded]-[/var/www/]-[git mysite_security_updates_apr2017]  $   composer --version Composer version 1.4.1 2017-03-10 09:29:45  [09:48 PM]-[vagrant@redisvmadded]-[/var/www/]-[git mysite_security_updates_apr2017]  $      [09:48 PM]-[vagrant@redisvmadded]-[/var/www/]-[git ou82_security_updates_apr2017]  $   php -v PHP (cli)  Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies     with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.5.1, Copyright (c) 2002-2017, by Derick Rethans 

I’m running the site locally inside a Vagrant/ provisioned VM running Ubuntu 14.04 LTS 64bit on top of a Mac OS X Sierra 10.12.4 host.

Undefined variable result while fetching data using laravel

I am new in laravel 5 Now what am I doing here Simply I want to fetch data from the database table states where country_id='101'. and apply foreach loop in my view file but it shows an error i.e. undefined variable: result. I don’t know why and where I am doing wrong? Please help me.


<?php     namespace App\Http\Controllers;     use Illuminate\Http\Request;     use DB;     use App\Http\Requests;     use App\Http\Controllers\Controller;      class FirstController extends Controller     {         public function state()         {             $  sql = DB::select('select * from states where country_id="101"');             return view('index',['result'=>$  sql]);         }     } 


<select name="state" class="form-control" id="state">     <option value="null">India:State</option>     @foreach($  result as $  row)         <option value="{{ $  row->id }}">{{ $  row->name }}</option>     @endforeach </select> 


<?php     Route::get('/', function () {         return view('index');     });     Route::get('index','FirstController@state'); 

Notice: Undefined index: imgRest in C:\xampp\htdocs\MetroFood\sprintPro1\php\vista\signupRest.php on line 41

Tengo un problema a la hora de pasar una imagen a la base de datos en mi codigo php, me aparece el notice: Notice: Undefined index: imgRest in C:\xampp\htdocs\MetroFood\sprintPro1\php\vista\signupRest.php on line 41 (Me sube toda la demas informacion pero no me sube la imagen). Todo el proceso lo estoy haciendo desde el mismo archivo php llamado signupRest.php

<?php    if (isset($  _POST['enviar']))   {     $  nombreRest = $  _POST["nombreRest"];     $  direcRest = $  _POST["direcRest"];     $  telRest = $  _POST["telRest"];     $  imgRest = addslashes(file_get_contents($  _FILES['imgRest']['tmp_name']));     $  idUsu = $  _SESSION["idUsuario"];      $  query = "INSERT INTO restaurante(nombreRest, imgRest, direcRest, telRest, idUsu) VALUES ('$  nombreRest','$  imgRest','$  direcRest','$  telRest','$  idUsu')";     $  resultado = $  conexion->query($  query);   }    ?> 

Este es el código php.

  <form class="form-container" action="signupRest.php" method="POST">                 <h1>Ingresa la informacion de tu restaurante </h1><br>                 <div class="form-group">                     <label for="nombreRest">Nombre de Restaurante</label>                     <input type="text" class="form-control" id="nombreRest" name="nombreRest" required placeholder="Ingresa tu nombre de Restaurante">                 </div>                 <div class="form-group">                     <label for="direcRest">Dirección del Restaurante</label>                     <input type="text" name="direcRest" class="form-control" id="direcRest" required placeholder="Ingrese su Dirección">                 </div>                 <div class="form-group">                     <label for="telRest"> Teléfono del Restaurante</label>                     <input type="text" class="form-control" id="telRest" name="telRest" required placeholder="Ingresa tu Número Teléfono">                 </div>                 <div class="form-group" zise>                     <label for="imgRest">Imágen del Restaurante</label>                     <input type="file" name="imgRest" class="form-control" id="imgRest" required placeholder="Ingresa tu Imágen de Restaurante">                 </div>                  <br>                  <?php if(!empty($  mensaje)): ?>                 <p> <?= $  mensaje ?></p>                 <?php endif; ?>                 <button type="submit" name="enviar" class="btn btn-success btn-block" style="width: 40%; margin: 0 auto; font-weight: bold;">Registrate</button>              </form> 

Y este es el formulario que pasa los datos.

Uncaught TypeError: Cannot destructure property `weight` of ‘undefined’ or ‘null’

I have this task where I am to build a BMI calculator based on specific instructions. I have followed all the instructions but seem to be getting something wrong. The final instruction says:

Get letsCalculateBMI to obtain the selected value from the SELECT element, pass that value to a getSelectedUser function call, which should return the user object for the selected value. This user object should be assigned to a user variable.

For a quicker view in computeBMI arrow function, the user parameter is an immediately destruct to weight, height, and country properties.

Currently the error I have is Uncaught TypeError: Cannot destructure propertyweightof 'undefined' or 'null'. at computeBMI (<anonymous>:16:19) at HTMLButtonElement.letsCalculateBMI


<!DOCTYPE html> <html lang="en">   <head>     <meta charset="UTF-8" />     <meta name="viewport"            content="width=device-width, initial-scale=1.0" />     <meta http-equiv="X-UA-Compatible" content="ie=edge" />      <title>Mini App</title>     </head>   <body>         <div class="select">       <select class="select-text">         <option disabled selected>Select User</option>               </select>     </div>      <div class="user-photo">       <img src="" alt="Placeholder" >     </div>      <div class="details mdc-elevation--z3">       <p>         <span class="prop" data-age>Age :</span>         <span class="value" data-age-value>23 years</span>       </p>       <p>         <span class="prop" data-height>Height :</span>         <span class="value" data-height-value>169cm</span>       </p>       <p>         <span class="prop" data-weight>Weight :</span>         <span class="value" data-weight-value>68kg</span>       </p>       <p>         <span class="prop" data-gender>Gender :</span>         <span class="value" data-gender-value>Female</span>       </p>       <p>         <span class="prop" data-country>Country :</span>         <span class="value" data-country-value>Nigerian</span>       </p>     </div>      <button id="oracle" class="mdc-button" onclick="letsCalculateBMI()">       Calculate BMI     </button>     <div id="outcome">       <h5 class="mdc-typography--headline5">         BMI       </h5>       <p class ="bmi-text"></p>     </div>      <script>       const users = [];        const countriesWithLowerBmi = ["Chad", "Sierra Leone", "Mali", "Gambia", "Uganda", "Ghana", "Senegal", "Somalia", "Ivory Coast", "Isreal"];              const featToMeter = 0.3048;        const bmiCountryRatio = 0.82;        const computeBMI = ({ weight, height, country }) => {          const heightInMeters = height * featToMeter;         let BMI = weight / (heightInMeters^2);          if (countriesWithLowerBmi.includes(country))            BMI *= bmiCountryRatio;          return Math.round(BMI, 2);       };        const getSelectedUser = (userId) => {         return users.find(({id}) => id === userId);       };        const displaySelectedUser = ({target}) => {         const user = getSelectedUser(target.value);         const properties = Object.keys(user);          properties.forEach(prop => {           const span = document.querySelector(`span[data-$  {prop}-value]`);             if(span) {               span.textContent= user[prop];                }         })                      }        const letsCalculateBMI = () => {          const value = document.querySelector('.select-text').value;          const user = getSelectedUser(value);          const bmi = computeBMI(user);          document.querySelector('.bmi-text').innerHTML = bmi       };        const powerupTheUI = () => {         const button = document.querySelector('#oracle');          const select = document.querySelector('.select-text');          select.addEventListener('change', displaySelectedUser);          button.addEventListener('click',letsCalculateBMI);       };              const displayUsers = (users) => {         users.forEach(user => {         const select = document.querySelector('.select-text');         const option = document.createElement('option');          option.text =;          option.value =;         select.appendChild(option);         });       };         const fetchAndDisplayUsers = () => {         users.push(           {           age: 40,           weight: 75,           height: 6,           country: 'Nigeria',           name: 'Charles Odili',           id: 'dfhb454768DghtF'           },           {           age: 23,           weight: 68,           height: 6,           country: 'Nigeria',           name: 'Simpcy',           id: 'gibb12erish'           }         );          displayUsers(users);       };        const startApp = () => {         powerupTheUI();         fetchAndDisplayUsers();       };        startApp();     </script>   </body> </html> ```