# Mapping combined resources to entities in different namespaces

**URL:** https://discourse.rom-rb.org/t/mapping-combined-resources-to-entities-in-different-namespaces/484
**Category:** Issues
**Created:** [October 13, 2021, 9:22am UTC](https://discourse.rom-rb.org/t/mapping-combined-resources-to-entities-in-different-namespaces/484 "2021-10-13T09:22:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![guilherme-andrade](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/guilherme-andrade/32/250_2.png) [@guilherme-andrade](https://discourse.rom-rb.org/u/guilherme-andrade)
#### Post date: [October 13, 2021, 9:22am UTC](https://discourse.rom-rb.org/t/mapping-combined-resources-to-entities-in-different-namespaces/484/1 "2021-10-13T09:22:22Z")

</div>

Hi there, newbie rom-rb user here, and this is probably a stupid question, will be happy to know if this completely violates rom patterns.

In **repositories** , is there a way to `combine` and relation, but mapping it to different namespace than the `root` relation?

Example:

```ruby
class Entities::Company < ROM::Struct
end

class Entities::Companies::Employee < ROM::Struct
end

class Persistence::CompaniesRelation < ROM::Relation
  schema :companies do
    associations do
      has_many :employees
    end
  end
end

class Persistence::Companies::EmployeesRelation < ROM::Relation
  schema :employees do
    associations do
      belongs_to :company
    end
  end
end

class Domain::CompaniesRepo < ROM::Repository[:companies]
  struct_namespace Domain::Entities

  def find(id)
    companies.combine(:employees).by_pk(id).one!
  end
end

# when calling Domain::CompaniesRepo#find
# => <Domain::Entities::Company :employees=[<Domain::Entities::Employee (...) >

```

Is there an option in `combine` that would allow me to change the `struct_namespace` from `Domain::Entities` to `Domain::Entities::Companies` for that specific node?

Thanks for all the help in advance!

---

<div class="post-metadata">

### Author: ![ianks](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/ianks/32/145_2.png) [@ianks](https://discourse.rom-rb.org/u/ianks)
#### Post date: [October 14, 2021, 1:01am UTC](https://discourse.rom-rb.org/t/mapping-combined-resources-to-entities-in-different-namespaces/484/2 "2021-10-14T01:01:58Z")

</div>

As far as I know, there is not unfortunately. We solved this by aliasing the generated constants, annoying but solves the issue;

```ruby
module Entities
  class User < ROM::Struct
    def full_name
       # …
    end
  end

  AdminUser ||= User
end

```
