auto_table_warning.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. use Cake\ORM\TableRegistry;
  16. $autoTables = TableRegistry::getTableLocator()->genericInstances();
  17. if (!$autoTables) {
  18. return;
  19. }
  20. ?>
  21. <h3>Could this be caused by using Auto-Tables?</h3>
  22. <p>
  23. Some of the Table objects in your application were created by instantiating "<strong>Cake\ORM\Table</strong>"
  24. instead of any other specific subclass.
  25. </p>
  26. <p>This could be the cause for this exception. Auto-Tables are created for you under the following circumstances:</p>
  27. <ul>
  28. <li>The class for the specified table does not exist.</li>
  29. <li>The Table was created with a typo: <strong><em>$this->getTableLocator()->get('Articles');</em></strong></li>
  30. <li>The class file has a typo in the name or incorrect namespace: <strong><em>class Articles extends Table</em></strong></li>
  31. <li>The file containing the class has a typo or incorrect casing: <strong><em>Articles.php</em></strong></li>
  32. <li>The Table was used using associations but the association has a typo: <strong><em>$this->belongsTo('Articles')</em></strong></li>
  33. <li>The table class resides in a Plugin but <strong><em>no plugin notation</em></strong> was used in the association definition.</li>
  34. </ul>
  35. <br>
  36. <p>Please try correcting the issue for the following table aliases:</p>
  37. <ul>
  38. <?php foreach ($autoTables as $alias => $table) : ?>
  39. <li><strong><?= $alias ?></strong></li>
  40. <?php endforeach; ?>
  41. </ul>
  42. <br>