Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readonlySchema to the Column annotation #75

Merged
merged 3 commits into from
May 16, 2023

Conversation

msmakouz
Copy link
Member

@msmakouz msmakouz commented Apr 27, 2023

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

@msmakouz msmakouz added the type:feature New feature. label Apr 27, 2023
@msmakouz msmakouz requested a review from roxblnfk April 27, 2023 14:12
@msmakouz msmakouz self-assigned this Apr 27, 2023
@roxblnfk roxblnfk marked this pull request as draft May 10, 2023 14:21
@roxblnfk roxblnfk marked this pull request as ready for review May 10, 2023 14:22
@roxblnfk
Copy link
Member

Please set cycle/database ^2.5.0

@codecov
Copy link

codecov bot commented May 12, 2023

Codecov Report

❗ 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%> (ø)

@roxblnfk roxblnfk changed the title Adding readonlySchema to the Column annotation Add readonlySchema to the Column annotation May 16, 2023
@roxblnfk roxblnfk merged commit 0fca640 into cycle:3.x May 16, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

💡 Add the ability to map column to property without declaring it in migration
2 participants