Data definition with simple types #10
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Research
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No project
No assignees
1 participant
Notifications
Total time spent: 58 minutes 17 seconds
Due date
c.fahner
58 minutes 17 seconds
No due date set.
Dependencies
No dependencies set
Reference
slendium/ocd!10
Loading…
Reference in a new issue
No description provided.
Delete branch "issues/1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #1.
Adds Entity, Schema and related classes.
@ -3,0 +22,4 @@#### Basic entityTODONeeds an example
@ -0,0 +9,4 @@* When implementing this interface the constructor must have a parameter called `id` of the type {@see Entity\Id}.* Further configuration of the ID requires adding the {@see Schema\IdOptions} attribute.** Fields are declared as parameters to the constructor of the entity."as parameters of the constructor"
@ -0,0 +12,4 @@* Fields are declared as parameters to the constructor of the entity.* These parameters are later used to reconstruct an entity from a database record.* Parameters can be excluded using the {@see Schema\Exclude} attribute.* The {@see Schema\FieldName} attribute specifies the field name if the parameter name should not be used."The FieldName attribute can be used to set the field name and prevent defaulting to the parameter name."
Went with "The {@see Schema\FieldName} attribute overrides the default field name (the parameter name)."
@ -0,0 +11,4 @@/*** Definition of an {@see Entity}'s structure and its relationships to other entities.** Use the {@see Schema\Exclude} attribute to exclude a field.Make an actual markdown list of the described attributes.
@ -0,0 +36,4 @@/*** Creates a schema from the constructor parameters of a given class.** If the given class implements {@see Entity\Identifiable} it is required to declared an `$id`"required to declare
dan"@ -0,0 +26,4 @@/*** The entity's regular fields.** Does not contain the `id` field if the entity implements {@see Entity\Identifiable}.Move this explanation to
fromConstructorParameters()@ -0,0 +60,4 @@throw Schema\DefinitionException::forMissingIdField();}$object->__construct($idOptions ?? new Schema\IdOptions(Schema\IdGenerator::None), $fields);Move
$idOptions ?? new ...to separate line:$idOptions ??= ...@ -0,0 +57,4 @@/** @return array{ type: Type, nullable: bool } */private static function extractTypeInfo(ReflectionParameter $parameter): array {$type = $parameter->getType();if ($type === null) {@ -0,0 +5,4 @@use Attribute;/*** Allows specifying a different name for a field than the one implied by parameter or property."Contains the preferred field name."
@ -0,0 +15,4 @@final class IdOptionsTest extends TestCase {public function test___construct_shouldNotThrow(): void {$sut = new IdOptions(IdGenerator::UniqueIdentifier);Arrange:
$generator = ...Act:
$result = new($generator)Assert:
$generator === $result->generator@ -0,0 +39,4 @@$this->assertFalse(isset($resultFields['id']));}public function test_fromConstructorParameters_shouldIgnoreExcludeAttributeAndSetDefaultGenerator_whenExcludeAttributeIsApplied(): void {_whenExcludeAttributeIsAppliedToId()