Skip to content
Advertisement

Generate entity from an existing table

I have a already created table:

CREATE TABLE `jt_version` (
    `version` int(11) NOT NULL COMMENT '103',
    `model` varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '108'

From this table, I have generated an entity.

 php bin/console doctrine:mapping:import "AppEntity" annotation --path=src/Entity

This entity generated creates something like this:

/**
 * @var int
 *
 * @ORMColumn(name="version", type="integer", nullable=false, options={"comment"="103"})
 */
private $version;

/**
 * @var string
 *
 * @ORMColumn(name="model", type="string", length=4, nullable=false, options={"default"="''","comment"="108"})
 */
private $model= '''';

My question is from where the value of model is getting set. In above case the $model value is ''''

Is that correct or I need to make some change?

Advertisement

Answer

This is set from the default value which you have specified in this

@ORMColumn(name="model", type="string", length=4, nullable=false, options={"default"="''","comment"="108"}}
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement