Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin won't register #1108

Closed
stereo9 opened this issue Sep 13, 2019 · 5 comments
Closed

Plugin won't register #1108

stereo9 opened this issue Sep 13, 2019 · 5 comments
Milestone

Comments

@stereo9
Copy link

stereo9 commented Sep 13, 2019

For testing issues I created a plugin to play around with what the system can do. I created an empty plugin to check if Kimai Recognizes it, but it doesn't.

I installed the CustomCSS Plugin which works fine.

Maybe the minimum requirements for plugins in the docs are not complete?

To Reproduce

  1. followed the instructions on https://www.kimai.org/documentation/plugins.html for minimum requirements
  2. created the minimum directory structure, Bundle class .php, composer.json
  3. refreshed cache
    bin/console cache:clear --env=prod
    bin/console cache:warmup --env=prod

In Kimai, the plugin is not shown in the plugins section.

I also tried to subscribe to the menu by creating a EventSubscriber/MenuSubscriber.php following https://www.kimai.org/documentation/developers.html#extending-the-navigation-bar

but since kimai doesnt recognize the plugin, it also doesnt show the menu item

Additional context

  • Kimai version 1.2
  • PHP version 7.1
@kevinpapst
Copy link
Member

There are many reasons why this can fail, so help is impossible without sharing the source code.
Can you create a repo with your current code?

@stereo9
Copy link
Author

stereo9 commented Sep 14, 2019

https://github.com/stereo9/TestBundle

its really just what is described as the minimum in the docs,

@kevinpapst
Copy link
Member

Well, I guess the documentation is not complete. I wrote it for people who are familiar with Symfony.

What you actually need:

.
├── DependencyInjection
│   └── TestExtension.php
├── Resources
│   └── config
│       └── services.yaml
├── TestBundle.php
└── composer.json

with TestExtension.php


namespace KimaiPlugin\TestBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class TestExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container)
    {
        try {
            $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
            $loader->load('services.yaml');
        } catch (\Exception $e) {
            echo '[TestBundle] invalid services config found: ' . $e->getMessage();
        }
    }
}

and services.yaml

services:
    _defaults:
        autowire: true
        autoconfigure: true
        public: false
        bind:

    KimaiPlugin\TestBundle\:
        resource: '../../*'
        exclude: '../../{Resources}'

@kevinpapst
Copy link
Member

@kevinpapst kevinpapst added this to the 1.4 milestone Sep 17, 2019
@lock
Copy link

lock bot commented Nov 16, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

@lock lock bot locked and limited conversation to collaborators Nov 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants