- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我真的很紧张,因为缺乏足够的资源来安装 SonataDoctrineMongoDBAdminBundle 以及它的依赖项,如 sonataUserBundle。我一直在尝试安装这个包 15 天。我做了每件事,再一次在奏鸣曲的官方页面上讲述了什么。但它不能正常工作。在将 SonataUserBundle 扩展为 ApplicationUserBundle 之后,我的最终文件是:
用户.php
<?php
/**
* This file is part of the <name> project.
*
* (c) <yourname> <youremail>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Application\Sonata\UserBundle\Document;
use Sonata\UserBundle\Document\BaseUser as BaseUser;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*
* @author <yourname> <youremail>
*/
class User extends BaseUser
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}
<?php
/**
* This file is part of the <name> project.
*
* (c) <yourname> <youremail>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Application\Sonata\UserBundle\Document;
use Sonata\UserBundle\Document\BaseGroup as BaseGroup;
/**
* This file has been generated by the EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
*
* References :
* working with object : http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*
* @author <yourname> <youremail>
*/
class Group extends BaseGroup
{
/**
* @var integer $id
*/
protected $id;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
}
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernel.debug%
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options: {}
default_database: test_database
document_managers:
default:
auto_mapping: true
# app/config/config.yml
sonata_block:
default_contexts: [cms]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
#sonata.admin_doctrine_orm.block.audit:
# contexts: [admin]
sonata.block.service.text:
sonata.block.service.rss:
# Some specific block from the SonataMediaBundle
#sonata.media.block.media:
#sonata.media.block.gallery:
#sonata.media.block.feature_media:
sonata_user:
security_acl: false
manager_type: mongodb # can be orm or mongodb
sonata_admin:
security:
handler: sonata.admin.security.handler.role
title: Sonatas Project
title_logo: /bundles/sonataadmin/logo_title.png
templates:
# default global templates
layout: SonataAdminBundle::standard_layout.html.twig
ajax: SonataAdminBundle::ajax_layout.html.twig
dashboard: SonataAdminBundle:Core:dashboard.html.twig
# default actions templates, should extend a global templates
list: SonataAdminBundle:CRUD:list.html.twig
show: SonataAdminBundle:CRUD:show.html.twig
edit: SonataAdminBundle:CRUD:edit.html.twig
dashboard:
blocks:
# display a dashboard block
- { position: left, type: sonata.admin.block.admin_list }
# Customize this part to add new block configuration
- { position: right, type: sonata.block.service.text, settings: { content: "<h2>Welcome to the Sonata Admin</h2> <p>This is a <code>sonata.block.service.text</code> from the Block Bundle, you can create and add new block in these area by configuring the <code>sonata_admin</code> section.</p> <br /> For instance, here a RSS feed parser (<code>sonata.block.service.rss</code>):"} }
- { position: right, type: sonata.block.service.rss, settings: { title: Sonata Project's Feeds, url: http://sonata-project.org/blog/archive.rss }}
# set to true to persist filter settings per admin module in the user's session
fos_user:
db_driver: mongodb # can be orm or odm
firewall_name: main
user_class: Application\Sonata\UserBundle\Document\User
group:
group_class: Application\Sonata\UserBundle\Document\Group
jms_security_extra:
secure_all_services: false
expressions: true
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
SONATA:
- ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT # if you are using acl then this line must be commented
providers:
fos_userbundle:
id: fos_user.user_manager
firewalls:
# -> custom firewall for the admin area of the URL
admin:
switch_user: true
context: user
pattern: /admin(.*)
form_login:
provider: fos_userbundle
login_path: /admin/login
use_forward: false
check_path: /admin/login_check
failure_path: null
use_referer: true
logout:
path: /admin/logout
target: /admin/login
anonymous: true
# -> end custom configuration
# defaut login area for standard users
main:
switch_user: true
context: user
pattern: .*
form_login:
provider: fos_userbundle
login_path: /login
use_forward: false
check_path: /login_check
failure_path: null
logout: true
anonymous: true
access_control:
# URL of FOSUserBundle which need to be available to anonymous users
- { path: ^/_wdt, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/_profiler, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
# -> custom access control for the admin area of the URL
- { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/login-check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
# -> end
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
# Secured part of the site
# This config requires being logged for the whole site and having the admin role for the admin part.
# Change these rules to adapt them to your needs
- { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
php app/console fos:user:create --super-admin
> db.fos_user_user.findOne();
{
"_id" : 1,
"createdAt" : ISODate("2013-05-25T19:43:52Z"),
"updatedAt" : ISODate("2013-05-25T19:43:52Z"),
"gender" : "u"
}
最佳答案
似乎继承映射工作不正常,我按照说明进行操作,但它导致了同样的问题。我通过将 BaseUser 的引用更改为 FOS\UserBundle 提供的类来修复它
# Application\Sonata\UserBundle\Document\User.php
namespace Application\Sonata\UserBundle\Document;
//use Sonata\UserBundle\Document\BaseUser as BaseUser;
use FOS\UserBundle\Document\User as BaseUser;
关于symfony - 如何正确安装 SonataDoctrineMongoDBAdminBundle?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16753475/
我开始从事一个用 Symfony 2.8 编写的大型项目。将整个项目升级到 SF 3 需要数百小时,现在还不可能。我想到了一个想法,将 symfony/symfony 包解压到它替换的单个包中(com
我在提交表单后使用 FOSUserEvents,但订阅者调用了两次。 这样我的验证码第一次有效第二次无效 这是我的代码 router = $router; $this->request
我有以下路线: blog_show: path: /test/123 defaults: { _controller: TotalcanBravofillBundle:Te
我是测试新手。我想测试我的功能。我已经成功安装了 phpUnit。我在互联网上查看了许多教程。但我无法获得有关测试的正确信息。这是我的功能代码: public function loginAction
我正在尝试重现 facebook batch requests 的行为在他们的图形 api 上运行。 所以我认为最简单的解决方案是在 Controller 上向我的应用程序发出几个请求,例如: pub
在 Symfony Progress Bar documentation有一个超酷酒吧的示例图像。不幸的是,看起来文档的其余部分没有解释如何获得这样的结果。 这是图片,以防您错过: 我怎么才能得到它?
我使用Finder发送假脱机电子邮件,但是自动名称生成器将点放在文件名中,有时它们出现在文件的开头。 查找程序似乎无法获取具有该名称的文件-那些文件被隐藏了……有人经历过这种行为吗?有什么建议如何使用
我正在尝试进行 LDAP 身份验证,我目前遇到此类错误: ServiceNotFoundException: The service "security.firewall.map.context.ma
有没有办法验证和检查集合数组是否为空。我已经尝试过: /** * @Assert\NotBlank() * @Assert\Length( min = 1) */ protected $work
使用Smyfony2和Doctrin2,可以使用以下示例创建数据固定装置:http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/i
我看到在大多数Symfony 2示例中,例如,不存在记录时,Symfony 2会引发异常。我认为这种方法对最终用户不友好。为什么有人更喜欢引发异常而不在Flashbag上添加一些错误消息? 最佳答案
我对项目中的以下服务有疑问: app.security.guardAuthenticatorLoginPassword: class: AppBundle\Security\LoginPa
symfony缓存和登录Docker容器存在问题。 Web服务器从www-data用户和组执行,当我使用docker上安装的php从docker容器中清除symfony缓存时,它从root执行。 因此
我想了解 symfony 中的服务 我已阅读http://symfony.com/doc/2.3/book/service_container.html#creating-configuring-se
因为我对 Symfony 和 Doctrine 还很陌生,所以我有一个可能很愚蠢的问题;-) 有人可以用简单的词语向我解释集合(尤其是实体中的ArrayCollections)吗?它是什么以及何时以及
我收到了这个表格: {{ form_start(form) }} {{ form_end(form) }} 我想检查用户是否登录,我这样做了: {% if is_g
我的网站已准备好部署,我正在尝试将其设置为在线。 一些信息: 主持人是 OVH。 它不允许 SSH,我必须使用 FTP 发送文件。也没有命令行。 我现在希望能够在子目录中设置网站:/www/test(
过去几个月以来,我一直在尝试与symfony合作。昨晚我自动删除了不需要的存储库。之后,我无法使用symfony命令创建新的symfony项目。当我在终端中运行Symfony new Security
In the environnement variable, then in system variable, I edited the path and added在环境变量中,然后在系统变量
我们有一个 Symfony 1.4 应用程序,想升级到 Symfony 4。是否有可能或者我们必须重新编程该应用程序? 我们询问了我们附近的一家软件公司,他们告诉我们必须重新编写应用程序。 最佳答案
我是一名优秀的程序员,十分优秀!