Skip to content

Commit 89be8e9

Browse files
committed
add deprecated errors to constructors, fix Upgrade.md
1 parent b7cd807 commit 89be8e9

File tree

6 files changed

+35
-13
lines changed

6 files changed

+35
-13
lines changed

Document/Group.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
use FOS\UserBundle\Model\Group as BaseGroup;
1515

1616
/**
17-
* @deprecated directly extend the model classes
17+
* @deprecated directly extend the classes in the Model namespace
1818
*/
1919
abstract class Group extends BaseGroup
2020
{
21+
public function __construct($name, $roles = array())
22+
{
23+
// you should extend the class in the Model namespace directly
24+
trigger_error(E_USER_DEPRECATED);
25+
parent::__construct($name, $roles);
26+
}
2127
}

Document/User.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
use FOS\UserBundle\Model\User as AbstractUser;
1515

1616
/**
17-
* @deprecated directly extend the model classes
17+
* @deprecated directly extend the classes in the Model namespace
1818
*/
1919
abstract class User extends AbstractUser
2020
{
21+
public function __construct()
22+
{
23+
// you should extend the class in the Model namespace directly
24+
trigger_error(E_USER_DEPRECATED);
25+
parent::__construct();
26+
}
2127
}

Entity/Group.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
use FOS\UserBundle\Model\Group as BaseGroup;
1515

1616
/**
17-
* @deprecated directly extend the model classes
17+
* @deprecated directly extend the classes in the Model namespace
1818
*/
1919
class Group extends BaseGroup
2020
{
21+
public function __construct($name, $roles = array())
22+
{
23+
// you should extend the class in the Model namespace directly
24+
trigger_error(E_USER_DEPRECATED);
25+
parent::__construct($name, $roles);
26+
}
2127
}

Entity/User.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
use FOS\UserBundle\Model\User as AbstractUser;
1515

1616
/**
17-
* @deprecated directly extend the model classes
17+
* @deprecated directly extend the classes in the Model namespace
1818
*/
1919
abstract class User extends AbstractUser
2020
{
21+
public function __construct()
22+
{
23+
// you should extend the class in the Model namespace directly
24+
trigger_error(E_USER_DEPRECATED);
25+
parent::__construct();
26+
}
2127
}

FOSUserBundle.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*/
2626
class FOSUserBundle extends Bundle
2727
{
28-
2928
public function build(ContainerBuilder $container)
3029
{
3130
parent::build($container);

Upgrade.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ Upgrade instruction
44
This document describes the changes needed when upgrading because of a BC
55
break. For the full list of changes, please look at the Changelog file.
66

7-
## 1.3.1 to 1.3.2
7+
## 1.3 to 2.0
88

99
### User and Group class
1010

11-
This bundle now registers mappings for the classes in Model directly, instead
12-
of having empty extending classes. The Entity/User and Document/User and Group
13-
classes are deprecated, you should update your User and Group classes to extend
14-
the classes found in Model directly.
15-
The old classes will stay around for a while and continue to work, but will be
16-
dropped for version 2.0.
17-
11+
This bundle now (registers mappings)[http://symfony.com/doc/master/cookbook/doctrine/mapping_model_classes.html]
12+
for the classes in the Model namespace directly, instead
13+
of having empty extending classes. The User and Group classes in the Entity and
14+
Document namespaces are deprecated, you should update your User and Group
15+
classes to extend the classes found in `Model`.
16+
The old classes will stay until 2.0 is released stable, but throw deprecated warnings.
1817

1918
## 1.2 to 1.3
2019

0 commit comments

Comments
 (0)