Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander M. Turek <me@derrabus.de>
  • Loading branch information
greg0ire and derrabus committed Oct 17, 2022
1 parent 4eb9289 commit 66cba2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/en/cookbook/decorator-pattern.rst
Expand Up @@ -167,14 +167,14 @@ of the getSpecial() method to its return value.
{
#[Column(type: 'string', nullable: true)]
protected $special;
protected string|null $special = null;
public function setSpecial(string $special): void
public function setSpecial(string|null $special): void
{
$this->special = $special;
}
public function getSpecial(): string
public function getSpecial(): string|null
{
return $this->special;
}
Expand Down
15 changes: 8 additions & 7 deletions docs/en/tutorials/composite-primary-keys.rst
Expand Up @@ -33,9 +33,9 @@ and year of production as primary keys:
{
public function __construct(
#[Id, Column(type: 'string')]
string $name,
private string $name,
#[Id, Column(type: 'integer')]
int $year,
private int $year,
) {
}
Expand Down Expand Up @@ -235,14 +235,14 @@ One good example for this is a user-address relationship:
class User
{
#[Id, Column(type: 'integer'), GeneratedValue]
private $id;
private int|null $id = null;
}
#[Entity]
class Address
{
#[Id, OneToOne(targetEntity: User::class)]
private $user;
private User|null $user = null;
}
.. code-block:: yaml
Expand Down Expand Up @@ -299,9 +299,10 @@ of products purchased and maybe even the current price.
#[Column(type: 'datetime')]
private DateTime $created;
public function __construct(Customer $customer)
{
$this->customer = $customer;
public function __construct(
#[ManyToOne(targetEntity: Customer::class)]
private Customer $customer,
) {
$this->items = new ArrayCollection();
$this->created = new DateTime("now");
}
Expand Down
4 changes: 2 additions & 2 deletions docs/en/tutorials/ordered-associations.rst
Expand Up @@ -22,9 +22,9 @@ can specify the ``@OrderBy`` in the following way:
{
// ...
#[ManyToMany(targetEntity: "Group")]
#[ManyToMany(targetEntity: Group::class)]
#[OrderBy(["name" => "ASC"])]
private $groups;
private Collection $groups;
}
.. code-block:: xml
Expand Down

0 comments on commit 66cba2c

Please sign in to comment.