gepur-it / datetime_6_doctrine_type
Gepur ERP datetime(6) doctrine type
Installs: 8 502
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- doctrine/dbal: >=2.5.4
This package is auto-updated.
Last update: 2024-11-13 01:01:34 UTC
README
How to write doctrine type "datetime(6)"
to your Symfony project
Add datetime(6): GepurIt\TinyintType\Datetime6DoctrineType
to types of dbal in doctrine. See example:
# Doctrine Configuration doctrine: dbal: default_connection: default connections: default: .gitignore.gitignore some_other: datetime(6): class: GepurIt\Datetime6Type\Datetime6DoctrineType commented: false
SQL type = 'DATETIME(6)'.
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") */ class EntityWithDatetime6Field { /** * @var integer * * @ORM\Column(name="created_at", type="datetime(6)", nullable=false) */ protected $createdAt = 0; /** * @return \DateTime */ public function getDirection(): \DateTime { return $this->createdAt; } /** * @param \DateTime $createdAt */ public function setDirection(\DateTime $createdAt): \DateTime { $this->createdAt = $createdAt; } }