DDD accessing reference values in Domain layer without repositories

So I have built a domain model and some logic into that. I have created two repositories for two aggregate roots.

My question is how to access to the reference data from these layers?. For example, say we have the following types Elder and Young.

Our application entry points expect Elder or Young as inputs. But, to validate and save this in the database (which has a foreign key to another table PERSON_TYPE which has these 2 values), I need to convert these IDs to store aggregate roots.

Could I create a PersonTypeRepository (in the domain layer) and use it when I persist my aggregate roots? Should this conversion happen in domain layer or should it happen in the application layer? For example, from a service

Booking Reference Number

I have received my itinerary with my booking ref number. I checked with the airline website and it matches what is in our booking ref number. Is this considered a confirmed ticket? Me and my son is travelling together. We have the same Booking ref number.

Thank you very very much.

Mrs Ana Pador

Reference Request: Total Variation Between Dependent and Independent Bernoulli Processes

Let $ X$ be a random variable taking values in $ \{0,1\}^n$ with the following distribution. For each coordinate $ i$ , we have $ p_i = P(X_i = 1) = c/\sqrt n$ , where $ c$ is a (very small) constant. Coordinates $ i$ and $ j$ have positive correlations exponentially decaying in $ |i-j|$ , with prefactor $ 1/\sqrt n$ , in the following sense: writing $ p_{i,j} = P(X_i = 1, \, X_j = 1)$ , we have $ $ 0 \le p_{i,j} – p_i p_j \le c \exp(-|i-j|)/\sqrt n. $ $ This is a dependent Bernoulli process. Let $ \mu$ denote the law of this.

Also, let $ Y$ be an independent Bernoulli process with the same marginals: $ P(Y_i = 1) = p_i$ and coordinates are independent. Let $ \nu$ denote the law of this.

I want to bound the total variation distance $ \|\mu-\nu\|_\text{TV}$ . In particular, I want to show that the TV distance decays with $ c$ , ie taking $ c \to 0$ gives $ \text{TV} \to 0$ .


I am aware of the Chen-Stein method for approaching questions like this, but to me this seems better suited when the probabilities $ p_i$ are order $ 1/n$ , and so there are a Poisson number of $ 1$ s in the independent case (and the method shows that the same holds for dependent case, under certain conditions). Perhaps one can apply Stein’s method more generally?

Also, the aim of this question isn’t to get a precise answer from someone, but rather a reference or suggested method of approach. The above is a simplified version of my actual problem, but I feel that if I can get a good handle on the above, then I can convert it to my specific case.

Insecure Direct Object Reference – Change email from client end

I am testing a website that has “Forgot my password” functionality. If user clicks that, his email address will be displayed as a hyperlink. If that is clicked, an email to reset password will be triggered to that Address. As an end user, I can change the hyperlink using Chrome developer tools to point to some other valid email address and trigger password reset to that user. Should I flag this issue? What are the implications this issue might have?

Drupal 8 + DB select to retrieve medias from a reference field (in nodes)

Inside a node type, I have a reference field to target a media. With a db select, I need to load all related medias of the nodes. For this I use this code:

$  database = \Drupal::database(); $  result = $  database->select('media_field_data', 'm') ->fields('m', ['mid']) ->condition('m.bundle', 'gallery') ->leftjoin('node__field_related_gallery', 'n', 'media_field_data.mid = node__field_related_gallery.field_related_gallery_target_id') ->leftjoin('field_related_gallery_media_field_data', 'd', 'node__field_related_gallery.entity_id = field_related_gallery_media_field_data.nid') ->range(0, 5) ->execute() ->fetchAllKeyed(0, 0); dpm($  result); 

But with this code I get an error and don’t get the related mids. If I remove the line with the leftjoin I get the mids.

How can I proceed to verify if a media is related to a node and get only the media with a related node?

With views I can get easily the results with this query:

SELECT media_field_data.mid AS mid,  field_related_gallery_media_field_data.nid AS  field_related_gallery_media_field_data_nid FROM {media_field_data} media_field_data LEFT JOIN {node__field_related_gallery} node__field_related_gallery ON   media_field_data.mid =   node__field_related_gallery.field_related_gallery_target_id AND   node__field_related_gallery.deleted = '0'  LEFT JOIN {node_field_data} field_related_gallery_media_field_data ON   node__field_related_gallery.entity_id =   field_related_gallery_media_field_data.nid  WHERE (media_field_data.status = '1') AND (media_field_data.bundle IN   ('gallery')) AND (field_related_gallery_media_field_data.nid IS NOT NULL)  LIMIT 26 OFFSET 0 

Thanks.