I already have a database with two tables "Album" and "Email". I tried to generate orm and entities from that using commands.
First I used the following command to generate orm
/opt/lampp/bin/php ./vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --from-database php ./module/Album/src/Album/Entity
That creates orm files as follows..
use Doctrine\ORM\Mapping\ClassMetadataInfo;
$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE);
$metadata->setPrimaryTable(array(
'name' => 'Album',
));
$metadata-
>setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->mapField(array(
'fieldName' => 'id',
'columnName' => 'id',
'type' => 'integer',
'nullable' => false,
'unsigned' => false,
'comment' => '',
'id' => true,
));
$metadata->mapField(array(
'fieldName' => 'artist',
'columnName' => 'artist',
'type' => 'string',
'nullable' => false,
'length' => 255,
'fixed' => false,
'comment' => '',
));
$metadata->mapField(array(
'fieldName' => 'title',
'columnName' => 'title',
'type' => 'string',
'nullable' => false,
'length' => 255,
'fixed' => false,
'comment' => '',
));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_IDENTITY);
After that I run the below command to generate entities from that orm files
/opt/lampp/bin/php ./vendor/doctrine/doctrine-module/bin/doctrine-module orm:generate-entities /modules/Album/src/Album/Entity
But, the last command returns the error in command prompt like..
Notice: Undefined variable: metadata in /opt/lampp/htdocs/ZendSkeleton/module/Album/src/Album/Entity/Album.php on line 5
Fatal error: Call to a member function setInheritanceType() on a non-object in /opt/lampp/htdocs/ZendSkeleton/module/Album/src/Album/Entity/Album.php on line 5
The $metadata variable is undefined...
Is there any thing wrong in what I did...?
How should I proceed next...? Please help me....