Skip to content

Commit 8f5f3ce

Browse files
committed
Deprecated expired and credentialsExpired
1 parent 4ba79ed commit 8f5f3ce

File tree

8 files changed

+15
-84
lines changed

8 files changed

+15
-84
lines changed

Changelog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
=========
33

4-
### 2.0.0 (2015-XX-XX)
4+
### 2.0.0-alpha2 (2015-XX-XX)
55

66
* [BC break] The deprecated entity classes have been removed.
77
* The minimum requirement for Symfony has been bumped to 2.3 (older versions are already EOLed).
@@ -11,6 +11,8 @@ Changelog
1111
* [BC break] The templating engine configuration has been removed, as well as the related code.
1212
* [BC break] Changed the XML namespace to `http://friendsofsymfony.github.io/schema/dic/user`
1313
* [BC break] Added `UserInterface::getId`.
14+
* [BC break] Removed unused properties `expired` and `credentialsExpired` including corresponding methods. This may break code,
15+
makes use of this methods, extending classes, and/or existing installations because of missing mappings for required db fields.
1416

1517
### 2.0.0-alpha1 (2014-09-26)
1618

Model/User.php

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ abstract class User implements UserInterface, GroupableInterface
9797
*/
9898
protected $locked;
9999

100-
/**
101-
* @var boolean
102-
*/
103-
protected $expired;
104-
105100
/**
106101
* @var \DateTime
107102
*/
@@ -112,11 +107,6 @@ abstract class User implements UserInterface, GroupableInterface
112107
*/
113108
protected $roles;
114109

115-
/**
116-
* @var boolean
117-
*/
118-
protected $credentialsExpired;
119-
120110
/**
121111
* @var \DateTime
122112
*/
@@ -127,9 +117,7 @@ public function __construct()
127117
$this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
128118
$this->enabled = false;
129119
$this->locked = false;
130-
$this->expired = false;
131120
$this->roles = array();
132-
$this->credentialsExpired = false;
133121
}
134122

135123
public function addRole($role)
@@ -161,9 +149,7 @@ public function serialize()
161149
$this->salt,
162150
$this->usernameCanonical,
163151
$this->username,
164-
$this->expired,
165152
$this->locked,
166-
$this->credentialsExpired,
167153
$this->enabled,
168154
$this->id,
169155
$this->expiresAt,
@@ -190,9 +176,7 @@ public function unserialize($serialized)
190176
$this->salt,
191177
$this->usernameCanonical,
192178
$this->username,
193-
$this->expired,
194179
$this->locked,
195-
$this->credentialsExpired,
196180
$this->enabled,
197181
$this->id,
198182
$this->expiresAt,
@@ -311,10 +295,6 @@ public function hasRole($role)
311295

312296
public function isAccountNonExpired()
313297
{
314-
if (true === $this->expired) {
315-
return false;
316-
}
317-
318298
if (null !== $this->expiresAt && $this->expiresAt->getTimestamp() < time()) {
319299
return false;
320300
}
@@ -329,32 +309,18 @@ public function isAccountNonLocked()
329309

330310
public function isCredentialsNonExpired()
331311
{
332-
if (true === $this->credentialsExpired) {
333-
return false;
334-
}
335-
336312
if (null !== $this->credentialsExpireAt && $this->credentialsExpireAt->getTimestamp() < time()) {
337313
return false;
338314
}
339315

340316
return true;
341317
}
342318

343-
public function isCredentialsExpired()
344-
{
345-
return !$this->isCredentialsNonExpired();
346-
}
347-
348319
public function isEnabled()
349320
{
350321
return $this->enabled;
351322
}
352323

353-
public function isExpired()
354-
{
355-
return !$this->isAccountNonExpired();
356-
}
357-
358324
public function isLocked()
359325
{
360326
return !$this->isAccountNonLocked();
@@ -401,18 +367,6 @@ public function setCredentialsExpireAt(\DateTime $date = null)
401367
return $this;
402368
}
403369

404-
/**
405-
* @param boolean $boolean
406-
*
407-
* @return User
408-
*/
409-
public function setCredentialsExpired($boolean)
410-
{
411-
$this->credentialsExpired = $boolean;
412-
413-
return $this;
414-
}
415-
416370
public function setEmail($email)
417371
{
418372
$this->email = $email;
@@ -434,20 +388,6 @@ public function setEnabled($boolean)
434388
return $this;
435389
}
436390

437-
/**
438-
* Sets this user to expired.
439-
*
440-
* @param Boolean $boolean
441-
*
442-
* @return User
443-
*/
444-
public function setExpired($boolean)
445-
{
446-
$this->expired = (Boolean) $boolean;
447-
448-
return $this;
449-
}
450-
451391
/**
452392
* @param \DateTime $date
453393
*

Propel/User.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ public function serialize()
4444
$this->username,
4545
$this->salt,
4646
$this->password,
47-
$this->expired,
4847
$this->locked,
49-
$this->credentials_expired,
5048
$this->enabled,
5149
$this->_new,
5250
)
@@ -69,9 +67,7 @@ public function unserialize($serialized)
6967
$this->username,
7068
$this->salt,
7169
$this->password,
72-
$this->expired,
7370
$this->locked,
74-
$this->credentials_expired,
7571
$this->enabled,
7672
$this->_new
7773
) = $data;
@@ -167,10 +163,6 @@ public function setRoles(array $v)
167163
*/
168164
public function isAccountNonExpired()
169165
{
170-
if (true === $this->getExpired()) {
171-
return false;
172-
}
173-
174166
if (null !== $this->getExpiresAt() && $this->getExpiresAt()->getTimestamp() < time()) {
175167
return false;
176168
}
@@ -191,10 +183,6 @@ public function isAccountNonLocked()
191183
*/
192184
public function isCredentialsNonExpired()
193185
{
194-
if (true === $this->getCredentialsExpired()) {
195-
return false;
196-
}
197-
198186
if (null !== $this->getCredentialsExpireAt() && $this->getCredentialsExpireAt()->getTimestamp() < time()) {
199187
return false;
200188
}

Resources/config/doctrine-mapping/User.couchdb.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<field name="password" fieldName="password" type="string" />
1313
<field name="lastLogin" fieldName="lastLogin" type="datetime" />
1414
<field name="locked" fieldName="locked" type="mixed" />
15-
<field name="expired" fieldName="expired" type="mixed" />
1615
<field name="expiresAt" fieldName="expiresAt" type="datetime" />
1716
<field name="confirmationToken" fieldName="confirmationToken" type="string" />
1817
<field name="passwordRequestedAt" fieldName="passwordRequestedAt" type="datetime" />

Resources/config/doctrine-mapping/User.mongodb.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
<field name="locked" fieldName="locked" type="boolean" />
2626

27-
<field name="expired" fieldName="expired" type="boolean" />
28-
2927
<field name="expiresAt" fieldName="expiresAt" type="date" />
3028

3129
<field name="confirmationToken" fieldName="confirmationToken" type="string" />
@@ -34,8 +32,6 @@
3432

3533
<field name="roles" fieldName="roles" type="collection" />
3634

37-
<field name="credentialsExpired" fieldName="credentialsExpired" type="boolean" />
38-
3935
<field name="credentialsExpireAt" fieldName="credentialsExpireAt" type="date" />
4036
<indexes>
4137
<index>

Resources/config/doctrine-mapping/User.orm.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
<field name="locked" column="locked" type="boolean" />
2626

27-
<field name="expired" column="expired" type="boolean" />
28-
2927
<field name="expiresAt" column="expires_at" type="datetime" nullable="true" />
3028

3129
<field name="confirmationToken" column="confirmation_token" type="string" nullable="true" />
@@ -34,8 +32,6 @@
3432

3533
<field name="roles" column="roles" type="array" />
3634

37-
<field name="credentialsExpired" column="credentials_expired" type="boolean" />
38-
3935
<field name="credentialsExpireAt" column="credentials_expire_at" type="datetime" nullable="true" />
4036

4137
</mapped-superclass>

Resources/config/propel/schema.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@
2020
<column name="password" type="varchar" size="255" required="true" />
2121
<column name="last_login" type="timestamp" required="false" />
2222
<column name="locked" type="boolean" defaultValue="false" />
23-
<column name="expired" type="boolean" defaultValue="false" />
2423
<column name="expires_at" type="timestamp" required="false" />
2524
<column name="confirmation_token" type="varchar" size="255" required="false" />
2625
<column name="password_requested_at" type="timestamp" required="false" />
27-
<column name="credentials_expired" type="boolean" defaultValue="false" />
2826
<column name="credentials_expire_at" type="timestamp" required="false" />
2927
<column name="roles" type="array" />
3028

Upgrade.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ 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+
## 2.0-alpha1 to 2.0.0-alpha2
8+
9+
Methods and properties removed from `FOS\UserBundle\Model\User`
10+
11+
- `$expired`
12+
- `$credentialsExpired`
13+
- `setExpired()` (use `setExpireAt(\DateTime::now()` instead)
14+
- `setCredentialsExpired()` (use `setCredentialsExpireAt(\DateTime::now()` instead)
15+
16+
You need to drop the fields `expired` and `credentials_expired` from your database
17+
schema, because they aren't mapped anymore.
18+
719
## 1.3 to 2.0-alpha1
820

921
### User Provider

0 commit comments

Comments
 (0)