# /Admin inaccesible after adding tag prop in services.xml

**URL:** https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576
**Category:** Shopware 6 (English)
**Tags:** general, installation--gettin
**Created:** [27. Mai 2022 um 11:00 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576 "2022-05-27T11:00:32Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![nabucodonosor336](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@nabucodonosor336](https://forum.shopware.com/u/nabucodonosor336)
#### Post date: [27. Mai 2022 um 11:00 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576/1 "2022-05-27T11:00:32Z")

</div>

I am new to shopware, I am getting familiar with it following the lessons provided in the accademy.  
At a certain point of the Entity lesson after creating the migration, a markup is added to the element (it should contain name and entity) and for some reasons when I add that to my code as well I am not able to access [http://localhost:8000/admin](http://localhost:8000/admin) anymore:

```auto
     <service id="Tentingg\Core\Content\Tentingg\TentinggDefinition">
          <tag name="shopware.entity.definition" entity="testing_plugin" />
                <!--entity correspond with the name returned in the entity definition -->
     </service>

```

if I remove the tag markup i can access /admin again, but if I write it back I will get the following error in the console:

```
        *XHRGEThttp://localhost:8000/api/_info/entity-schema.json[HTTP/1.1 500 Internal Server Error 1525ms]*
        
        *XHRGEThttp://localhost:8000/api/_info/open-api-schema.json[HTTP/1.1 500 Internal Server Error 1609ms]*
        
        *Object { message: "Request failed with status code 500", name: "AxiosError", code: "ERR_BAD_RESPONSE", config: {…}, request: XMLHttpRequest, response: {…}, stack: "" }*
        
        *[commons.js:1:95175](http://localhost:8000/bundles/administration/static/js/commons.js?1653585792226414)*
        
        *Uncaught (in promise) TypeError: Shopware.Service(...) is undefined*
        
        *pLPA http://localhost:8000/bundles/administration/static/js/app.js?16535857926696175:1*
        
        *get http://localhost:8000/bundles/administration/static/js/vendors-node.js?16535857921632683:2*
        
        *Ue http://localhost:8000/bundles/administration/static/js/commons.js?1653585792226414:1*
        
        *value http://localhost:8000/bundles/administration/static/js/app.js?16535857926696175:1*
        
        *value http://localhost:8000/bundles/administration/static/js/app.js?16535857926696175:1*
        
        *value http://localhost:8000/bundles/administration/static/js/app.js?16535857926696175:1*
        
        *value http://localhost:8000/bundles/administration/static/js/commons.js?1653585792226414:1*
        
        *value http://localhost:8000/bundles/administration/static/js/commons.js?1653585792226414:1*
        
        *promise callback*value http://localhost:8000/bundles/administration/static/js/commons.js?1653585792226414:1*
        
        *value http://localhost:8000/bundles/administration/static/js/commons.js?1653585792226414:1*
        
        *value http://localhost:8000/bundles/administration/static/js/commons.js?1653585792226414:1*
        
        *<anonymous> http://localhost:8000/admin#/sw/dashboard/index:39*

```

I would like to ask why are we adding those values in the xml file (I am not familiar with xml) and what could cause the error above mentioned that prevents me to access /admin in the browser.

---

<div class="post-metadata">

### Author: ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.shopware.com/u/abdullah)
#### Post date: [27. Mai 2022 um 16:43 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576/2 "2022-05-27T16:43:14Z")

</div>

I think you have an error in your „Tentingg\Core\Content\Tentingg\TentinggDefinition“ class.

The XML Tag Element tags the service as a Shopware entity definition.

---

<div class="post-metadata">

### Author: ![nabucodonosor336](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@nabucodonosor336](https://forum.shopware.com/u/nabucodonosor336)
#### Post date: [27. Mai 2022 um 17:22 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576/3 "2022-05-27T17:22:11Z")

</div>

Thanks Abdullah,  
let me share my entiry definition with you:

```auto
<?php declare(strict_types=1);

namespace Tentingg\Core\Content\Tentingg;

use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
use Shopware\Core\Framework\DataAbstractionLayer\Field\ManyToOneAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\OneToManyAssociationField;
use Shopware\Core\Framework\DataAbstractionLayer\FieldCollection;
use Shopware\Core\System\CustomEntity\Xml\Field\OneToManyField;

class TentinggDefinition extends EntityDefinition
{

    public function getEntityName(): string
    {
        return 'testing_plugin';
    }
    

    public function getCollectionClass(): string
    {
        return TentinggCollection::class;
    }
    

    public function getEntityClass(): string
    {
        return TentinggEntity::class;
    }
    

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([

            (new IdField('id','id'))->addFlags(new Required(), new PrimaryKey()),
            new BoolField('active','active'),
            (new StringField('name','active'))->addFlags(new Required()),
            new FkField('country_id','countryId',CountryDefinition::class),

            new ManyToOneAssociationField(
                'country', //property name
                'country_id', //storage_name
                 CountryDefinition::class, // reference class
                 'id', // reference field
                 false //autoload
                ) 
        ]);
        
    }
}

```

---

<div class="post-metadata">

### Author: ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.shopware.com/u/abdullah)
#### Post date: [27. Mai 2022 um 17:45 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576/4 "2022-05-27T17:45:47Z")

</div>

Maybe

new StringField(‚name‘,‚active‘)

could cause the problem?

---

<div class="post-metadata">

### Author: ![nabucodonosor336](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@nabucodonosor336](https://forum.shopware.com/u/nabucodonosor336)
#### Post date: [27. Mai 2022 um 19:12 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576/5 "2022-05-27T19:12:37Z")

</div>

Not really.  
But if I return an empty array from the defineFields() function, it works - so I think you are right about the problem being in the entity definition, but I cant still figure out what’s the problem.

---

<div class="post-metadata">

### Author: ![abdullah](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@abdullah](https://forum.shopware.com/u/abdullah)
#### Post date: [27. Mai 2022 um 19:32 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576/6 "2022-05-27T19:32:27Z")

</div>

You have to import the classes IdField, BoolField, StringField and FkField.  
I think that’s the problem.

---

<div class="post-metadata">

### Author: ![nabucodonosor336](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@nabucodonosor336](https://forum.shopware.com/u/nabucodonosor336)
#### Post date: [27. Mai 2022 um 20:41 UTC](https://forum.shopware.com/t/admin-inaccesible-after-adding-tag-prop-in-services-xml/94576/7 "2022-05-27T20:41:11Z")

</div>

Thanks, it did fix the problem indeed but I also had to import the flags classes (required, primary\_key).

```auto
use Shopware\Core\Framework\DataAbstractionLayer\Field\IdField;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\PrimaryKey;
use Shopware\Core\Framework\DataAbstractionLayer\Field\Flag\Required;

```

It would have saved me time if the console errors were pointing directly at the problem, but maybe I could switch to phpStorm IDE to spot missing classes easily.

Thanks again!
