'Should I separate Database Objects vs Objects I used for example in a Rest Controller

I am currently creating a simple application with my friend and we cannot decide how should we separate certain objects. For example in a rest controller which receives a "UserRequest" in the request

public class UserRequest{
private String id;
private String username;
}

We are going to use this for other API integration or validation logic, but at the same time, we are going to insert the User into a MySQL Table, now usually we use annotations like @Entity, @Table to define that this object is going to be used in the DB Repo.

@Entity
public class User{
private String id;
private String username;
private Date   gmtCreate;
}

now on a high level the "gmtCreate" is the field difference, however there can be other datbaase related fields that we can add that does not matter on the UserRequest object but basically they are mostly redundant.

Need help to decide whether we should create separate objects 1 - User (used for rest controller and java logic operations), 2 - UserDBObject (used for database operations)

or should we unify them into a single object User and ignore fields based on the usage.



Solution 1:[1]

By looking at the provided code you probably forgot the entry tags in your base-template ?

{% block stylesheets %}

      {{ encore_entry_link_tags('app') }}

 {% endblock %}

 {% block javascripts %}

      {{ encore_entry_script_tags('app') }}
 
 {% endblock %}

https://symfony.com/doc/current/frontend/encore/simple-example.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1