cycle / annotated

Schema generation using annotated entities and mappers
MIT License
23 stars 12 forks source link

Add `readonlySchema` to the `Column` annotation #75

Closed msmakouz closed 1 year ago

msmakouz commented 1 year ago

Feature

Added the ability to disable schema synchronization for the assigned column via readonlySchema: true:

use App\Infrastructure\Persistence\CycleORMUserRepository;
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Entity;

#[Entity(
    repository: CycleORMUserRepository::class
)]
class User
{
    public function __construct(
        #[Column(type: 'primary')]
        public int $id,
        #[Column(type: 'string(64)')]
        public string $username,
        #[Column(type: 'string', readonlySchema: true)]
        public string $email
    ) {
    }
}

Similar to the readonlySchema parameter in the Entity annotation: https://github.com/cycle/annotated/blob/3.x/src/Annotation/Entity.php#L38

roxblnfk commented 1 year ago

Please set cycle/database ^2.5.0

codecov[bot] commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (3.x@44cdb42). Click here to learn what that means. The diff coverage is 100.00%.

@@          Coverage Diff           @@
##             3.x      #75   +/-   ##
======================================
  Coverage       ?   91.18%           
  Complexity     ?      264           
======================================
  Files          ?       32           
  Lines          ?      681           
  Branches       ?        0           
======================================
  Hits           ?      621           
  Misses         ?       60           
  Partials       ?        0           
Impacted Files Coverage Δ
src/Annotation/Column.php 100.00% <100.00%> (ø)
src/Configurator.php 87.94% <100.00%> (ø)