# Pluginübergreifener Namespace / Sourcen

**URL:** <https://forum.shopware.com/t/pluginubergreifener-namespace-sourcen/54238>\
**Category:** Programmierung\
**Created:** [24. Juli 2018 um 09:50 UTC](https://forum.shopware.com/t/pluginubergreifener-namespace-sourcen/54238 "2018-07-24T09:50:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AvL](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@AvL](https://forum.shopware.com/u/AvL)\
**Post date:** [24. Juli 2018 um 09:50 UTC](https://forum.shopware.com/t/pluginubergreifener-namespace-sourcen/54238/1 "2018-07-24T09:50:25Z")

</div>

Hallo,

ich entwickel derzeit ein Plugin welches aus 2 einzelnen Plugins besteht. Es gibt eine Art Container-Plugin (A) und dann gibt es ein Plugin (B) welches bestimmte Sourcen aus Plugin (A) nutzen soll. Ich möche dies über Namesspaces lösen.

Als Code habe ich folgendes:

PluginA / Bootstrap.php

```
class Shopware_Plugins_Backend_PluginA_Bootstrap extends Shopware_Components_Plugin_Bootstrap {
	...
	
    public function afterInit() {
        $this->Application()->Loader()->registerNamespace('Shopware\Plugina', $this->Path());
    }
	...
}

 PluginA / Lib/Client.php 

namespace Shopware\Plugina\Lib;

class Client {
	...
}

```

Plugin B / Bootstrap.php

```
class Shopware_Plugins_Backend_PluginB_Bootstrap extends Shopware_Components_Plugin_Bootstrap {
	...
	
    public function afterInit() {
        $this->Application()->Loader()->registerNamespace('Shopware\Plugina', $this->Path().'../PluginA'); // Komplette Angabe mit DOCUMENT_ROOT funktioniert auch nicht
    }
	...
}

```

Wenn ich nun über einen Controller über PluginB auf den Client zugreifen möchte, erhalte ich immer die Meldung:

PHP Fatal error: &nbsp;Class ‘Client’ not found

Gibt es hier einen Lösungsansatz oder übersehe ich etwas grundlegendes?

Grüße  
&nbsp;

---

<div class="post-metadata">

**Author:** ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)\
**Post date:** [24. Juli 2018 um 16:01 UTC](https://forum.shopware.com/t/pluginubergreifener-namespace-sourcen/54238/2 "2018-07-24T16:01:47Z")

</div>

Bevor du den Client constructest ruf mal Shopware()-\>Plugins()-\>Backend()-\>PluginA() auf

---

<div class="post-metadata">

**Author:** ![AvL](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@AvL](https://forum.shopware.com/u/AvL)\
**Post date:** [24. Juli 2018 um 22:35 UTC](https://forum.shopware.com/t/pluginubergreifener-namespace-sourcen/54238/3 "2018-07-24T22:35:11Z")

</div>

Hallo Shyim,

vielen Dank für den Tipp. Hat super funktioniert&nbsp; ![Thumb-Up](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/thumb-up.png "Thumb-Up")

Grüße  
Andreas
