Skip to content

Instantly share code, notes, and snippets.

@TorbenKoehn
Last active July 8, 2016 16:58
Show Gist options
  • Save TorbenKoehn/d22cf4e537bbc85ca774b54a6993ae03 to your computer and use it in GitHub Desktop.
Save TorbenKoehn/d22cf4e537bbc85ca774b54a6993ae03 to your computer and use it in GitHub Desktop.
<?php
class Column implements Annotation
{
private string $type;
private int $length;
private bool $nullable;
public function __construct(string $type, int $length = null, bool $nullable = false)
{
$this->type = $type;
$this->length = $length;
}
public function getType(): string
{
return $this->type;
}
public function getLength(): int
{
return $this->length;
}
public function isNullable()
{
return $this->nullable;
}
}
<<Entity("users")>>
class User
{
<<Id>>
private string $id;
<<Column("string", 50), Assert\IsAlphaNumeric, Assert\Between(0, 100)>>
private string $name;
<<Column("string", nullable=true, length=100)>>
private string $slug;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment