FriendsOfAkeneo / CustomEntityBundle

Eases the creation of custom entity and related views in the PIM
Other
53 stars 61 forks source link

Error 500 when Entity creation #191

Closed nicolasfl closed 6 years ago

nicolasfl commented 6 years ago

Hi everyone, I'm actually facing an issue while creating a custom entity. All the functionalities about this custom entity are working except the creation. I get an 500 error when I submit the creation form. I've tried to add it directly in DB and edit it from the interface and that works perfectly. I started to debug all the saving process until the function save() in BaseSaver. All the validations are okay and I get the error when the objectManager tries to flush.

Here is my Mapping.orm.yml file Extensions\Bundle\MappingConnectorBundle\Entity\Mapping: repositoryClass: Pim\Bundle\CustomEntityBundle\Entity\Repository\CustomEntityRepository type: entity table: mapping_connector_attributes changeTrackingPolicy: DEFERRED_EXPLICIT fields: id: type: integer id: true generator: strategy: AUTO code: type: string length: 255 unique: true import: type: string length: 255 attribute: type: string length: 255 column: type: string length: 255 sortOrder: type: integer lifecycleCallbacks: { }

And my Entity file : ` namespace Extensions\Bundle\MappingConnectorBundle\Entity;

use Pim\Bundle\CustomEntityBundle\Entity\AbstractCustomEntity;

class Mapping extends AbstractCustomEntity {

/**
 * @var  $import
 */
protected $import;
/**
 * @var  $attribute
 */
protected $attribute;
/**
 * @var  $column
 */
protected $column;

/**
 * @return mixed
 */
public function getImport()
{
    return $this->import;
}

/**
 * @param mixed $import
 */
public function setImport($import)
{
    $this->import = $import;
}

/**
 * @return mixed
 */
public function getAttribute()
{
    return $this->attribute;
}

/**
 * @param mixed $attribute
 */
public function setAttribute($attribute)
{
    $this->attribute = $attribute;
}

/**
 * @return mixed
 */
public function getColumn()
{
    return $this->column;
}

/**
 * @param mixed $column
 */
public function setColumn($column)
{
    $this->column = $column;
}

}`

Thanks in advance :)

nicolasfl commented 6 years ago

Error fixed. It wasn't an issue coming from the bundle but from mysql. In fact, mysql doesn't accept columns named "column", so it was creating an error when I was trying to INSERT a value in DB.