我有一个问题,我被困在某事上.我最近使用默认设置创建了AWS EC2 Ubuntu实例.我本地也有一台Ubuntu机器,到目前为止,我设法使用此命令成功连接到Ubuntu实例
ssh -i /var/www/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com
Run Code Online (Sandbox Code Playgroud)
但是我想知道是否有一种更简单的方法来登录ssh而不是每次登录时都传递私钥并将其ip添加到我的~/.ssh/config所以我可以轻松登录ssh ubuntu@some.ip.number.顺便说一句,我正在使用AWS免费套餐包.
Symfony 新手。如何使用 Doctrine 从数据库加载当前登录用户的角色。我有 3 张桌子是这样布置的。
users=> ( user_id, username, password, email)
user_roles=> ( id,user_id,role_id)
roles => (role_id, role_name)
我有每个表的实体及其相应的存储库。
我的 security.yaml 看起来像这样。
security:
encoders:
App\Entity\User:
algorithm: bcrypt
providers:
our_db_provider:
entity:
class: App\Entity\User
property: username
# if you're using multiple entity managers
# manager_name: customer
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
# pattern: ^/
# http_basic: ~
provider: our_db_provider
anonymous: true
form_login:
#login_path is GET request used ti display the form
# needs …Run Code Online (Sandbox Code Playgroud) 这里是symfony的新手
我的计算机中有两个连接设置config/packages/doctrine.yaml。
Connection 1 is default; //connects to localhost:mysql:root:password:local_db
Connection 2 is remote; // connection to a server xxx.xxx.xx.xxx.:username:pwd:remote_db
Run Code Online (Sandbox Code Playgroud)
是否可以使用cli工具生成Entity类,php bin/console make:entity Product以在自定义目录中生成实体。
当我运行上述命令时,“ Product”实体类在我的src/Entity/目录中生成,但我希望根据我们的需要生成它,
所以可以说在场景1中,我希望它在src/Entity/Customer/目录中生成Entity类,
在方案2中,我希望它在src/Entity/Products/目录中生成Entity类。如果我能够做到这一点,那么迁移和实体映射对我来说将变得容易得多。