gepur-it / tiny_int_type
Gepur ERP Tinyint doctrine type
Installs: 10 904
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^7.3
- doctrine/dbal: >=2.5.4
This package is auto-updated.
Last update: 2024-11-05 03:42:35 UTC
README
How to write doctrine type "tinyint"
to your Symfony project
Add tinyint: GepurIt\TinyintType\TynyintDoctrineType
to types of dbal in doctrine. See example:
# Doctrine Configuration doctrine: dbal: default_connection: default connections: default: some_other: types: email: GepurIt\TinyintType\TynyintDoctrineType
SQL type = 'TINYINT(1)'.
Example of entity:
namespace YourBundle\Entity; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as JMS; use Symfony\Component\Validator\Constraints as Assert; /** Class EntityWithEmailField * @package YourBundle\Entity * * @ORM\Table( * name="your_table_name", * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"} * ) * @ORM\Entity(repositoryClass="YourBundle\Repository\EntityWithTynyintFieldRepository") * @ORM\HasLifecycleCallbacks() * @codeCoverageIgnore */ class EntityWithTynyintField { /** * @var integer * * @ORM\Column(name="direction", type="tinyint", nullable=false) */ protected $direction = 0; /** * @return int */ public function getDirection(): int { return $this->direction; } /** * @param int $direction */ public function setDirection(int $direction): void { $this->direction = $direction; } }