Skip to content

Commit 3f32d73

Browse files
author
Jakob Hirsch
committed
fixed PHP 8.4 warnings and Doctrine errors
1 parent 6d35578 commit 3f32d73

7 files changed

Lines changed: 66 additions & 62 deletions

File tree

lib/Interpreter/Virtual/TimestampIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
class TimestampIterator extends \IteratorIterator {
3030
#[\ReturnTypeWillChange]
31-
function current() {
31+
function current() : mixed {
3232
return parent::current()[0];
3333
}
3434
}

lib/Model/Aggregate.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@
2323

2424
namespace Volkszaehler\Model;
2525

26-
use Doctrine\ORM\Mapping as ORM;
26+
#use Doctrine\ORM\Mapping as ORM;
2727

2828
/**
2929
* Aggregate materialized view entity
3030
*
3131
* @author Andreas Goetz <cpuidle@gmx.de>
3232
*
33-
* @ORM\Entity
34-
* @ORM\Table(name="aggregate")
33+
* @Doctrine\ORM\Mapping\Entity
34+
* @Doctrine\ORM\Mapping\Table(name="aggregate")
3535
*/
3636
class Aggregate
3737
{
3838
/**
39-
* @ORM\Id
40-
* @ORM\ManyToOne(targetEntity="Channel", inversedBy="aggregate")
41-
* @ORM\JoinColumn(name="channel_id", referencedColumnName="id")
39+
* @Doctrine\ORM\Mapping\Id
40+
* @Doctrine\ORM\Mapping\ManyToOne(targetEntity="Channel", inversedBy="aggregate")
41+
* @Doctrine\ORM\Mapping\JoinColumn(name="channel_id", referencedColumnName="id")
4242
*
4343
* @todo implement inverse side (Channel->aggregate)
4444
*/
@@ -47,28 +47,28 @@ class Aggregate
4747
/**
4848
* Aggregation type
4949
*
50-
* @ORM\Id
51-
* @ORM\Column(type="smallint")
50+
* @Doctrine\ORM\Mapping\Id
51+
* @Doctrine\ORM\Mapping\Column(type="smallint")
5252
*/
5353
protected $type;
5454

5555
/**
5656
* Ending timestamp of period in ms since 1970
5757
*
58-
* @ORM\Id
59-
* @ORM\Column(type="bigint")
58+
* @Doctrine\ORM\Mapping\Id
59+
* @Doctrine\ORM\Mapping\Column(type="bigint")
6060
*/
6161
protected $timestamp;
6262

6363
/**
64-
* @ORM\Column(type="float", nullable=false)
64+
* @Doctrine\ORM\Mapping\Column(type="float", nullable=false)
6565
*/
6666
protected $value;
6767

6868
/**
6969
* Aggregated row count
7070
*
71-
* @ORM\Column(type="integer", nullable=false)
71+
* @Doctrine\ORM\Mapping\Column(type="integer", nullable=false)
7272
*/
7373
protected $count;
7474

lib/Model/Aggregator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@
2424
namespace Volkszaehler\Model;
2525

2626
use Doctrine\Common\Collections\ArrayCollection;
27-
use Doctrine\ORM\Mapping as ORM;
27+
#use Doctrine\ORM\Mapping as ORM;
2828

2929
/**
3030
* Aggregator entity
3131
*
3232
* @author Steffen Vogel <info@steffenvogel.de>
3333
* @todo use nested sets: http://github.com/blt04/doctrine2-nestedset
3434
*
35-
* @ORM\Entity
35+
* @Doctrine\ORM\Mapping\Entity
3636
*/
3737
class Aggregator extends Entity
3838
{
3939
/**
40-
* @ORM\ManyToMany(targetEntity="Entity", inversedBy="parents")
41-
* @ORM\JoinTable(name="entities_in_aggregator",
42-
* joinColumns={@ORM\JoinColumn(name="parent_id", referencedColumnName="id", nullable=false)},
43-
* inverseJoinColumns={@ORM\JoinColumn(name="child_id", referencedColumnName="id", nullable=false)}
40+
* @Doctrine\ORM\Mapping\ManyToMany(targetEntity="Entity", inversedBy="parents")
41+
* @Doctrine\ORM\Mapping\JoinTable(name="entities_in_aggregator",
42+
* joinColumns={@Doctrine\ORM\Mapping\JoinColumn(name="parent_id", referencedColumnName="id", nullable=false)},
43+
* inverseJoinColumns={@Doctrine\ORM\Mapping\JoinColumn(name="child_id", referencedColumnName="id", nullable=false)}
4444
* )
4545
*/
4646
protected $children = NULL;

lib/Model/Channel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@
2626
use Volkszaehler\Interpreter\SQL;
2727
use Doctrine\DBAL;
2828
use Doctrine\Common\Collections\ArrayCollection;
29-
use Doctrine\ORM\Mapping as ORM;
29+
#use Doctrine\ORM\Mapping as ORM;
3030

3131
/**
3232
* Channel entity
3333
*
3434
* @author Steffen Vogel <info@steffenvogel.de>
3535
*
36-
* @ORM\Entity
36+
* @Doctrine\ORM\Mapping\Entity
3737
*/
3838
class Channel extends Entity
3939
{
4040
/**
41-
* @ORM\OneToMany(targetEntity="Data", mappedBy="channel", cascade={"persist"}, orphanRemoval=true)
42-
* @ORM\OrderBy({"timestamp" = "ASC"})
41+
* @Doctrine\ORM\Mapping\OneToMany(targetEntity="Data", mappedBy="channel", cascade={"persist"}, orphanRemoval=true)
42+
* @Doctrine\ORM\Mapping\OrderBy({"timestamp" = "ASC"})
4343
* @var ArrayCollection|null
4444
*/
4545
protected $data = NULL;

lib/Model/Data.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,34 @@
2323

2424
namespace Volkszaehler\Model;
2525

26-
use Doctrine\ORM\Mapping as ORM;
26+
#use Doctrine\ORM\Mapping as ORM;
2727

2828
/**
2929
* Data entity
3030
*
3131
* @author Steffen Vogel <info@steffenvogel.de>
3232
* @author Andreas Goetz <cpuidle@gmx.de>
3333
*
34-
* @ORM\Entity
35-
* @ORM\Table(name="data")
34+
* @Doctrine\ORM\Mapping\Entity
35+
* @Doctrine\ORM\Mapping\Table(name="data")
3636
*/
3737
class Data
3838
{
3939
/**
40-
* @ORM\Id
41-
* @ORM\ManyToOne(targetEntity="Channel", inversedBy="data")
42-
* @ORM\JoinColumn(name="channel_id", referencedColumnName="id")
40+
* @Doctrine\ORM\Mapping\Id
41+
* @Doctrine\ORM\Mapping\ManyToOne(targetEntity="Channel", inversedBy="data")
42+
* @Doctrine\ORM\Mapping\JoinColumn(name="channel_id", referencedColumnName="id")
4343
*/
4444
protected $channel;
4545

4646
/**
47-
* @ORM\Id
48-
* @ORM\Column(type="bigint")
47+
* @Doctrine\ORM\Mapping\Id
48+
* @Doctrine\ORM\Mapping\Column(type="bigint")
4949
*/
5050
protected $timestamp;
5151

5252
/**
53-
* @ORM\Column(type="float", nullable=false)
53+
* @Doctrine\ORM\Mapping\Column(type="float", nullable=false)
5454
*/
5555
protected $value;
5656

lib/Model/Entity.php

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
use Doctrine\Common\Collections;
2727
use Webpatser\Uuid\Uuid as UUID;
28-
use Doctrine\ORM\Mapping as ORM;
28+
//use Doctrine\ORM\Mapping as ORM;
29+
#use Doctrine\ORM\Mapping;
2930

3031
use Volkszaehler\Definition;
3132

@@ -36,43 +37,46 @@
3637
*
3738
* @Annotation
3839
*
39-
* @ORM\Entity
40-
* @ORM\Table(name="entities")
41-
* @ORM\InheritanceType("SINGLE_TABLE")
42-
* @ORM\DiscriminatorColumn(name="class", type="string")
43-
* @ORM\DiscriminatorMap({
40+
* @Doctrine\ORM\Mapping\Entity
41+
* @Doctrine\ORM\Mapping\Table(name="entities")
42+
* @Doctrine\ORM\Mapping\InheritanceType("SINGLE_TABLE")
43+
* @Doctrine\ORM\Mapping\DiscriminatorColumn(name="class", type="string")
44+
* @Doctrine\ORM\Mapping\DiscriminatorMap({
4445
* "channel" = "Channel",
4546
* "aggregator" = "Aggregator"
4647
* })
47-
* @ORM\HasLifecycleCallbacks
48+
* @Doctrine\ORM\Mapping\HasLifecycleCallbacks
4849
*/
4950
abstract class Entity
5051
{
52+
const UUID_LENGTH = 36;
53+
5154
/**
52-
* @ORM\Id
53-
* @ORM\Column(type="integer")
54-
* @ORM\GeneratedValue(strategy="AUTO")
55+
* @Doctrine\ORM\Mapping\Id
56+
* @Doctrine\ORM\Mapping\Column(type="integer")
57+
* @Doctrine\ORM\Mapping\GeneratedValue(strategy="AUTO")
5558
*/
5659
protected $id;
5760

5861
/**
59-
* @ORM\Column(type="string", length=36, nullable=false, unique=true)
62+
* Doctrine\ORM\Mapping\Column(type="string", length=36, nullable=false, unique=true)
63+
* @Doctrine\ORM\Mapping\Column(type="string", length=self::UUID_LENGTH, nullable=false, unique=true)
6064
*/
6165
protected $uuid;
6266

6367
/**
64-
* @ORM\Column(type="string", nullable=false)
68+
* @Doctrine\ORM\Mapping\Column(type="string", nullable=false)
6569
*/
6670
protected $type;
6771

6872
/**
69-
* @ORM\OneToMany(targetEntity="Property", mappedBy="entity", cascade={"remove", "persist"}, orphanRemoval=true)
70-
* @ORM\OrderBy({"key" = "ASC"})
73+
* @Doctrine\ORM\Mapping\OneToMany(targetEntity="Property", mappedBy="entity", cascade={"remove", "persist"}, orphanRemoval=true)
74+
* @Doctrine\ORM\Mapping\OrderBy({"key" = "ASC"})
7175
*/
7276
protected $properties = NULL;
7377

7478
/**
75-
* @ORM\ManyToMany(targetEntity="Aggregator", mappedBy="children")
79+
* @Doctrine\ORM\Mapping\ManyToMany(targetEntity="Aggregator", mappedBy="children")
7680
*/
7781
protected $parents = NULL;
7882

@@ -98,7 +102,7 @@ public function __construct($type)
98102
/**
99103
* Checks for required and invalid properties
100104
*
101-
* @ORM\PrePersist
105+
* @Doctrine\ORM\Mapping\PrePersist
102106
*/
103107
public function checkProperties()
104108
{

lib/Model/Property.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Volkszaehler\Model;
2525

26-
use Doctrine\ORM\Mapping as ORM;
26+
#use Doctrine\ORM\Mapping as ORM;
2727

2828
use Volkszaehler\Definition;
2929

@@ -32,28 +32,28 @@
3232
*
3333
* @author Steffen Vogel <info@steffenvogel.de>
3434
*
35-
* @ORM\Entity
36-
* @ORM\Table(name="properties")
37-
* @ORM\HasLifecycleCallbacks
35+
* @Doctrine\ORM\Mapping\Entity
36+
* @Doctrine\ORM\Mapping\Table(name="properties")
37+
* @Doctrine\ORM\Mapping\HasLifecycleCallbacks
3838
*/
3939
class Property
4040
{
4141
/**
42-
* @ORM\Id
43-
* @ORM\ManyToOne(targetEntity="Entity", inversedBy="properties")
44-
* @ORM\JoinColumn(name="entity_id")
42+
* @Doctrine\ORM\Mapping\Id
43+
* @Doctrine\ORM\Mapping\ManyToOne(targetEntity="Entity", inversedBy="properties")
44+
* @Doctrine\ORM\Mapping\JoinColumn(name="entity_id")
4545
*/
4646
protected $entity;
4747

4848
/**
49-
* @ORM\Id
50-
* @ORM\Column(name="pkey", type="string")
49+
* @Doctrine\ORM\Mapping\Id
50+
* @Doctrine\ORM\Mapping\Column(name="pkey", type="string")
5151
* HINT: column name "key" is reserved by mysql
5252
*/
5353
protected $key;
5454

5555
/**
56-
* @ORM\Column(type="text", nullable=false)
56+
* @Doctrine\ORM\Mapping\Column(type="text", nullable=false)
5757
*/
5858
protected $value;
5959

@@ -73,7 +73,7 @@ public function __construct(Entity $entity, $key, $value)
7373
/**
7474
* Cast property value according to $this->type
7575
*
76-
* @ORM\PostLoad
76+
* @Doctrine\ORM\Mapping\PostLoad
7777
*/
7878
public function cast()
7979
{
@@ -90,7 +90,7 @@ public function cast()
9090
/**
9191
* Undo type cast to prevent Doctrine storing unmodified properties
9292
*
93-
* @ORM\PreFlush
93+
* @Doctrine\ORM\Mapping\PreFlush
9494
*/
9595
public function uncast()
9696
{
@@ -106,8 +106,8 @@ public function uncast()
106106
*
107107
* Throws an exception if something is incorrect
108108
*
109-
* @ORM\PrePersist
110-
* @ORM\PreUpdate
109+
* @Doctrine\ORM\Mapping\PrePersist
110+
* @Doctrine\ORM\Mapping\PreUpdate
111111
*/
112112
public function validate()
113113
{

0 commit comments

Comments
 (0)