unionco / calendarize

Calendar Field Type for CraftCMS
MIT License
18 stars 15 forks source link

Installing Calendarize: "CalendarRecord.php does not comply with psr-4 autoloading standard. Skipping." #64

Closed StefKors closed 3 years ago

StefKors commented 3 years ago

I'm not super familiar with Craft CMS and Calendarize. When running composer install calendarize I get the following error:

Class unionco\calendarize\records\CalendarizeRecord located in ./vendor/unionco/calendarize/src/records/CalendarRecord.php does not comply with psr-4 autoloading standard. Skipping.
  "require": {
    "craftcms/cms": "3.4.23",
    "vlucas/phpdotenv": "^3.4.0",
    "nystudio107/craft-seomatic": "3.2.41",
    "nystudio107/craft-twigpack": "1.1.13",
    "craftcms/redactor": "2.5.0",
    "nystudio107/craft-typogrify": "1.1.18",
    "putyourlightson/craft-sendgrid": "1.2.0",
    "unionco/calendarize": "1.2.16",
    "verbb/cloner": "1.1.0"
  },
  "autoload": {
    "psr-4": {
      "modules\\": "modules/"
    }
  },
  "config": {
    "optimize-autoloader": true,
    "platform": {
      "php": "7.2"
    }
  },

Anything I can do to resolve the problem?

StefKors commented 3 years ago

based on this stackoverflow answer https://laracasts.com/discuss/channels/laravel/psr-4-error-with-composer-2

The following change silenced the error:

diff --git a/src/records/CalendarizeRecord.php b/src/records/CalendarizeRecord.php
index 85cce2e..4ea9f49 100644
--- a/src/records/CalendarizeRecord.php
+++ b/src/records/CalendarizeRecord.php
@@ -8,7 +8,7 @@
  * @copyright Copyright (c) 2018 Franco Valdes
  */

-namespace unionco\calendarize\records;
+namespace \unionco\calendarize\records;

 use craft\db\ActiveRecord;
 use craft\records\Element;

Sadly it doesn't solve my underlying craft error yet. 🤷‍♂️

Error
Class 'unionco\calendarize\records\CalendarizeRecord' not found
StefKors commented 3 years ago

Just saw the latest commit, I'll be updating to that version to see if it solves my issue (https://github.com/unionco/calendarize/commit/0c6acc37cdcc5ae3f0493d31c2c527b918f66965)

StefKors commented 3 years ago

alright updating to 1.2.18 solved it

giphy