-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from CvekCoding/attributes
Use attributes
- Loading branch information
Showing
2 changed files
with
46 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|