-
Notifications
You must be signed in to change notification settings - Fork 54
Description
if (!$this->modx->addPackage('Database', $this->config['modelPath'] , $this->prefix))
Creates the tables in the schema, but with the modx_ prefix.
switching it to
if (!$this->modx->setPackage('Database', $this->config['modelPath'] , $this->prefix)) {
Performs as expected subsequently allowing tables to be created correctly. But also has the problem of changing the prefix for the MODX\Revolution package.
[2019-09-06 12:29:24] (ERROR @ /home/wshawn/public_html/core/src/Revolution/modParser.php : 508) Could not find snippet with name ServiceList.
[2019-09-06 12:29:24] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 529) Error 42S02 executing query: SELECT `modSnippet`.`id` AS `modSnippet_id`, `modSnippet`.`source` AS `modSnippet_source`, `modSnippet`.`property_preprocess` AS `modSnippet_property_preprocess`, `modSnippet`.`name` AS `modSnippet_name`, `modSnippet`.`description` AS `modSnippet_description`, `modSnippet`.`editor_type` AS `modSnippet_editor_type`, `modSnippet`.`category` AS `modSnippet_category`, `modSnippet`.`cache_type` AS `modSnippet_cache_type`, `modSnippet`.`snippet` AS `modSnippet_snippet`, `modSnippet`.`locked` AS `modSnippet_locked`, `modSnippet`.`properties` AS `modSnippet_properties`, `modSnippet`.`moduleguid` AS `modSnippet_moduleguid`, `modSnippet`.`static` AS `modSnippet_static`, `modSnippet`.`static_file` AS `modSnippet_static_file`, `Source`.`id` AS `Source_id`, `Source`.`name` AS `Source_name`, `Source`.`description` AS `Source_description`, `Source`.`class_key` AS `Source_class_key`, `Source`.`properties` AS `Source_properties`, `Source`.`is_stream` AS `Source_is_stream` FROM `bbl_site_snippets` AS `modSnippet` LEFT JOIN `bbl_media_sources` `Source` ON `modSnippet`.`source` = `Source`.`id` WHERE `modSnippet`.`name` = ? ORDER BY `modSnippet`.`id` ASC - Array
(
[0] => 42S02
[1] => 1146
[2] => Table 'wshawn_master.bbl_site_snippets' doesn't exist
)
[2019-09-06 12:29:24] (ERROR @ /home/wshawn/public_html/core/src/Revolution/modParser.php : 508) Could not find snippet with name ServiceList.
[2019-09-06 12:29:24] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 227) Error 42S02 executing statement:
Array
(
[0] => 42S02
[1] => 1146
[2] => Table 'wshawn_master.bbl_session' doesn't exist
)
[2019-09-06 12:29:24] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 1443) Error 42S02 executing statement:
INSERT INTO `bbl_session` (`id`, `access`, `data`) VALUES ('3e741417857274c8a3c53eab6683b60f', 1567772964, 'modx.user.contextTokens|a:1:{s:3:\"mgr\";i:1;}manager_language|s:2:\"en\";modx.user.0.resourceGroups|a:1:{s:3:\"mgr\";a:0:{}}modx.user.0.attributes|a:1:{s:3:\"mgr\";a:5:{s:16:\"modAccessContext\";a:1:{s:3:\"web\";a:1:{i:0;a:3:{s:9:\"principal\";i:0;s:9:\"authority\";s:1:\"0\";s:6:\"policy\";a:1:{s:4:\"load\";b:1;}}}}s:22:\"modAccessResourceGroup\";a:0:{}s:17:\"modAccessCategory\";a:0:{}s:28:\"sources.modAccessMediaSource\";a:0:{}s:18:\"modAccessNamespace\";a:0:{}}}modx.mgr.user.token|s:52:\"modx5d694e8518de66.43856135_15d7250aaa8b745.88377583\";modx.mgr.session.cookie.lifetime|i:0;modx.mgr.user.config|a:0:{}')
Array
(
[0] => 42S02
[1] => 1146
[2] => Table 'wshawn_master.bbl_session' doesn't exist
)
As mentioned in #154 PSR-4 is a bit of a pain. The Parser can create the base files anywhere you point it to, but then xpdo->addPackage / setPackage can not load them.
06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblAward from mysql.sanityllc\devotional\database\bblaward
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblAwardPatron from mysql.sanityllc\devotional\database\bblawardpatron
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblAwardType from mysql.sanityllc\devotional\database\bblawardtype
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblCache from mysql.sanityllc\devotional\database\bblcache
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblLanguage from mysql.sanityllc\devotional\database\bbllanguage
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblPatron from mysql.sanityllc\devotional\database\bblpatron
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblPatronHistory from mysql.sanityllc\devotional\database\bblpatronhistory
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblReadingPlan from mysql.sanityllc\devotional\database\bblreadingplan
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblReadingPlanContent from mysql.sanityllc\devotional\database\bblreadingplancontent
[2019-09-06 12:40:26] (ERROR @ /home/wshawn/public_html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 652) Could not load class: SanityLLC\Devotional\Database\bblVolume from mysql.sanityllc\devotional\database\bblvolume
The Not Found is solved by using an autoloader within the main addon Class, but then appears to not be needed.
Using the exact same format as the MODX installer:
$this->modx->addPackage('SanityLLC\Devotional', MODX_CORE_PATH . 'components/', $this->prefix);
$this->prefix is set to 'bbl_'
The prefix is ignored. I even tried placing it within the schema like we did in legacy versions.
For what it is worth, I do have PSR-4 working. It is just using the wrong prefix.