Skip to content

Commit

Permalink
Merge pull request #1 from CvekCoding/attributes
Browse files Browse the repository at this point in the history
Use attributes
  • Loading branch information
CvekCoding authored Nov 21, 2024
2 parents 4de5f23 + 1a7a224 commit 22e3e88
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 57 deletions.
53 changes: 22 additions & 31 deletions src/Entity/StateMachineTrait.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,32 @@
<?php
/**
* This file is part of the Diningedge package.
* This file is part of the Cvek package.
*
* (c) Sergey Logachev <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Cvek\WorkflowBundle\Entity;
namespace Cvek\WorkflowBundle\Entity;

trait StateMachineTrait
{
/**
* @var string|null
*
* @ORM\Column(type="string")
*/
private ?string $state = null;

/**
* @return string
*/
public function getState(): ?string
{
return $this->state;
}

/**
* @param string $state
*
* @return StateMachineTrait
*/
public function setState(string $state): self
{
$this->state = $state;

return $this;
}
}
use Doctrine\ORM\Mapping\Column;

trait StateMachineTrait
{
#[Column(type: 'string')]
private ?string $state = null;

public function getState(): ?string
{
return $this->state;
}

public function setState(string $state): self
{
$this->state = $state;

return $this;
}
}

50 changes: 24 additions & 26 deletions src/Entity/WorkflowTrait.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
<?php
/**
* This file is part of the Aqua-Delivery package.
* This file is part of the Cvek package.
*
* (c) Sergey Logachev <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Cvek\WorkflowBundle\Entity;
namespace Cvek\WorkflowBundle\Entity;

trait WorkflowTrait
{
/**
* @var array|null
*
* @ORM\Column(type="json", options={"jsonb"=true}, nullable=true)
*/
private ?array $states = null;

public function getStates(): ?iterable
{
return $this->states;
}

/**
* @param array $states
*/
public function setStates(iterable $states): self
{
$this->states = $states;

return $this;
}
}
use Doctrine\ORM\Mapping\Column;

trait WorkflowTrait
{
/** @var array<string> */
#[Column(type: 'json', options: ['jsonb' => true], nullable: true)]
private ?array $states = null;

public function getStates(): ?iterable
{
return $this->states;
}

/** @param array<string> $states */
public function setStates(iterable $states): self
{
$this->states = $states;

return $this;
}
}

0 comments on commit 22e3e88

Please sign in to comment.