Last active
February 7, 2019 10:31
-
-
Save meshenka/4ff5734a600f3a5fd9dfc9a872892fa2 to your computer and use it in GitHub Desktop.
Mapped Super Abstract Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bin/console doctrine:mapping:info | |
Found 2 mapped entities: | |
[OK] App\Store\Entity\ProductEntity | |
[OK] App\Domain\Model\Product | |
bin/console doctrine:schema:create --dump-sql | |
The following SQL statements will be executed: | |
#grr still no SQL produced :( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parameters: | |
# Adds a fallback DATABASE_URL if the env var is not set. | |
# This allows you to run cache:warmup even if your | |
# environment variables are not available yet. | |
# You should not need to change this value. | |
env(DATABASE_URL): '' | |
doctrine: | |
dbal: | |
# configure these for your database server | |
driver: 'pdo_mysql' | |
server_version: '5.7' | |
charset: utf8mb4 | |
# With Symfony 3.3, remove the `resolve:` prefix | |
url: '%env(resolve:DATABASE_URL)%' | |
orm: | |
auto_generate_proxy_classes: '%kernel.debug%' | |
naming_strategy: doctrine.orm.naming_strategy.underscore | |
auto_mapping: true | |
mappings: | |
App\Store: | |
is_bundle: false | |
type: xml | |
dir: '%kernel.project_dir%/src/Resources/config/doctrine/store' | |
prefix: 'App\Store\Entity' | |
alias: Store | |
App\Domain: | |
is_bundle: false | |
type: xml | |
dir: '%kernel.project_dir%/src/Resources/config/doctrine/model' | |
prefix: 'App\Domain\Model' | |
alias: Domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | |
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | |
<mapped-superclass name="App\Domain\Model\Product"> | |
<field name="name" | |
type="string" | |
length="50" | |
column="name"/> | |
<field name="price" | |
type="decimal" | |
precision="2" | |
scale="7"> | |
<options> | |
<option name="comment">Price in Euro</option> | |
<option name="default">0.0</option> | |
</options> | |
</field> | |
<field name="description" | |
type="text" | |
length="50" | |
nullable="true"/> | |
</mapped-superclass> | |
</doctrine-mapping> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | |
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | |
<entity name="App\Store\Entity\ProductEntity" | |
table="product" | |
schema="schema_name" | |
repository-class="App\Store\Repository\ProductRepository" | |
read-only="false"> | |
<id name="id" | |
type="integer"> | |
<generator strategy="AUTO" /> | |
</id> | |
<indexes> | |
<index name="name_index" | |
columns="name"/> | |
</indexes> | |
<field name="slug" | |
type="string" | |
length="255" | |
nullable="false"> | |
<options> | |
<option name="comment">slug is used to generate url to the product page</option> | |
</options> | |
</field> | |
</entity> | |
</doctrine-mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment