gepur-it / email_address_type
Gepur ERP PhoneNumber doctrine type
Installs: 18 676
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: >=7.3
- ext-mbstring: *
- doctrine/dbal: >=2.5.4
- jms/serializer: >=3.1
Requires (Dev)
- phpunit/phpunit: ^7.2
This package is auto-updated.
Last update: 2024-11-05 02:13:03 UTC
README
How to write doctrine type "email"
to your Symfony project
Add email: GepurIt\EmailAddress\EmailDoctrineType
to types of dbal in doctrine. See example:
# Doctrine Configuration doctrine: dbal: default_connection: default connections: default: some_other: types: email: GepurIt\EmailAddress\EmailDoctrineType
SQL type = 'VARCHAR(120)'.
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; use GepurIt\EmailAddress\Email /** Class EntityWithEmailField * @package YourBundle\Entity * * @ORM\Table( * name="your_table_name", * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"} * ) * @ORM\Entity(repositoryClass="YourBundle\Repository\EntityWithEmailFieldRepository") * @ORM\HasLifecycleCallbacks() * @codeCoverageIgnore */ class EntityWithEmailField { /** * @var Email * * @ORM\Column(name="email_address_column", type="email_address") * @JMS\Expose() * @JMS\Groups({"full", "Default"}) */ private $email; /** * @return Email */ public function getEmail() { return $this->email; } /** * @param Email $email */ public function setEmail(Email $email) { $this->email = $email; } }
How to use service EmailHelper - see example:
services: email.helper: class: GepurIt\EmailAddress\EmailHelper public: true