Symfony / SonataUser - BaseUser的抽象方法出错

时间:2016-05-06 17:32:20

标签: symfony sonata sonata-user-bundle

我试图安装SonataUserBundle,所以我按照文档(&使用EasyExtendBundle但我收到此错误:

/^[0-9]{2}-[0-9]{2,3}[a-zA-Z]?$/

我没有更改EasyExtends生成的用户实体......

Config看起来不错:

[Symfony\Component\Debug\Exception\FatalErrorException]                                              
  Error: Class Sonata\UserBundle\Entity\BaseUser contains 35 abstract methods and must therefore be declared abstract
   or implement the remaining methods (FOS\UserBundle\Model\UserInterface::setUsername, FOS\UserBundle\Model\UserInte
  rface::getUsernameCanonical, FOS\UserBundle\Model\UserInterface::setUsernameCanonical, ...) 

我的作曲家:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Application\Sonata\UserBundle\Entity\User
    group:
        group_class: Application\Sonata\UserBundle\Entity\Group 
        group_manager: sonata.user.orm.group_manager
    service:
        user_manager: sonata.user.orm.user_manager

有人有解决方案吗?

感谢您的帮助!

3 个答案:

答案 0 :(得分:0)

fos_user的配置错误...您必须使用Sonata名称空间实体...而不是Application名称空间中生成的名称空间实体

Private Sub CommandButton2_Click()
Application.Run "Sheet05.PA05"
End Sub

Sub PA05()

Dim fnd As String, FirstFound As String, counter  As Integer
Dim FoundCell As Range, rng As Range
Dim myRange As Range, LastCell As Range, moduleRange As Range

counter = 3

'What value do you want to find (must be in string form)?
  fnd = Range("A1")

Set myRange = Worksheets("EBS Modules & Data").Range("C3:O24")
Set LastCell = myRange.Cells(myRange.Cells.Count)
Set FoundCell = myRange.Find(What:=fnd, LookAt:=xlWhole, After:=LastCell)

'Test to see if anything was found
  If Not FoundCell Is Nothing Then
    FirstFound = FoundCell.Address
  Else
    GoTo NothingFound
  End If

Set rng = FoundCell

'Loop until cycled through all unique finds
  Do Until FoundCell Is Nothing

     With Worksheets("EBS Modules & Data")

        Set moduleRange = .Cells(FoundCell.Row, 1)
        moduleRange.Copy Sheet05.Range(Cells(counter, 1), Cells(counter, 1))
        counter = counter + 1

     End With

    'Find next cell with fnd value
      Set FoundCell = myRange.FindNext(After:=FoundCell)

    'Add found cell to rng range variable
      Set rng = Union(rng, FoundCell)

    'Test to see if cycled through to first found cell
      If FoundCell.Address = FirstFound Then Exit Do


  Loop


Exit Sub

'Error Handler
NothingFound:
  MsgBox "No values were found in this worksheet"

End Sub

注意user_class和group_class引用BaseEntity autovivification

答案 1 :(得分:0)

我终于从一个新项目开始并使用https://github.com/sonata-project/sandbox作为基础(我的项目将使用其他一些奏鸣曲项目)

所以,可能是配置错误......

答案 2 :(得分:0)

我想这是sonata和friendsofsymfony之间的版本问题。 我的composer.json就像这样

PS C:\Users\user> python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import pathlib
>>> path = 'd:\\asdf'
>>> print(os.path.abspath(path))
d:\asdf
>>> print(pathlib.Path(path).resolve())
\\vboxsrv\code\asdf

也许我们可以有匹配的版本......