1

I try to generate entities from database. What I do:

php console.php orm:convert-mapping --force --from-database annotation /var/www/test/src/test/Entity 

This command generate for me Entities class

Processing entity "ProductAdditional"
Processing entity "ProductSizes"
Processing entity "Products"

Entiti classes loks like:

<?php



use Doctrine\ORM\Mapping as ORM;

/**
 * ProductAdditional
 *
 * @ORM\Table(name="Product_additional")
 * @ORM\Entity
 */
class ProductAdditional
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="key", type="string", length=255, nullable=false)
     */
    private $key;

    /**
     * @var string
     *
     * @ORM\Column(name="value", type="string", length=255, nullable=false)
     */
    private $value;

    /**
     * @var string
     *
     * @ORM\Column(name="Type", type="string", length=255, nullable=false)
     */
    private $type;

    /**
     * @var integer
     *
     * @ORM\Column(name="product_id", type="integer", nullable=false)
     */
    private $productId;


}

In nex step I try generate entities methods with command:

php console.php orm:generate:entities /var/www/test/src/test/Entity

And get error:

Fatal error: Cannot redeclare class ProductAdditional in /var/www/test.ebay.gateway/src/test/Entity/ProductAdditional.php on line 14

What can cause my problem ? How to generate method for my entities ? I mean setter and getters .

Wizard
  • 10,985
  • 38
  • 91
  • 165
  • The cause of the problem is part of the error message. You generate methods for your entities by not doing the fatal error. The error message has been describben in depth already, if you run into an error message, please consult references first. – hakre Mar 25 '15 at 13:42

0 Answers0