How do I add taxonomy to my custom entity? I am working with a custom entity and I would like to be able to add taxonomy to the entity.  The drupal 8 entity documentation is lacking.

I have tried reading Node.php and term.php entitiy files but I don't understand how any sort of taxonomy is linked to any other entity though this.

Do I need to change something in my entity definition to allow taxonomy to be added? Or is there a way to access the taxonomy entity?

Edit:  I am working on the same pattern to add this to the install file of my module

'category' =&gt; array(
                'type' =&gt; 'varchar',
                'not null' =&gt; TRUE,
                'default' =&gt; '',
                'description' =&gt; 'The section front  to appear on',
            ),


this is the exception that I get trying to install the module

exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error [error]
or access violation: 1064 You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the
right syntax to use near 'NOT NULL DEFAULT '' COMMENT 'The section
front  to appear on',
As Clive said, you use an entity reference field for that, just like articles have a tags reference field to terms.

If you want to define it in code, it's really the same as the node.uid field, which is an entity reference to a user. Or the user.roles field, which is a multivalue reference to user roles. Entities reference others using an entity reference field, it's always the same pattern.