Custom class not found

Hello,

first off, I’d like to mention I’m not a PHP developer. I was tasked with migrating some of our legacy apps and I’ve run into some issues. I’ve been able to solve some of them, but currently stuck on Class 'app\models\GadgetDateTime' not found exception for a class defined in models.

I’m migrating code from a running and working application, so I’m not sure what exactly might be the issue here.

My goal is to create a docker image, the draft version of a docker file looks something like this

# syntax=docker/dockerfile:1.0.0-experimental
# ---------------------- composer ----------------------
FROM composer:1 as vendor

COPY packages/  /

RUN mkdir /build
COPY . /build

WORKDIR /build/admin
RUN composer install \
    --ignore-platform-reqs \
    --no-interaction \
    --no-plugins \
    --no-scripts \
    --prefer-dist

# ---------------------- dist ----------------------
FROM php:7-apache

COPY . /var/www/html
RUN chown -R www-data:www-data /var/www/html

COPY 000-default-admin.conf /etc/apache2/sites-available/000-default.conf

COPY --from=vendor /build/admin/vendor/ /var/www/html/admin/vendor/

# nice urls
RUN a2enmod rewrite
# database dependencies
RUN docker-php-ext-install pdo pdo_mysql
# zip
RUN apt-get update && apt-get install -y libzip-dev zip 
RUN docker-php-ext-install zip

The problematic class is GadgetDateTime. The class resides in models/GadgetDateTime.php

<?php

namespace app\models;

use yii\base\Model;

class GadgetDateTime extends Model {}

One thing that comes to mind is possibly missing some PHP extensions which block the mechanism? On a side note, I had to add aliases into app config in order for the app to even start (they are not defined in the running version)

'aliases' => [
    '@bower' => '@vendor/bower-asset',
    '@npm'   => '@vendor/npm-asset',
]

Thank you for any help!

The issue was that at some point in the past composer.lock in the repository and the one used for the deployed version diverted. When I used the older (deployed) composer.lock it works now. Somewhat mysterious error message for bad package versions (still within the realm of yii2).