Mautic Community Forums

Extending Lead entity giving "DoctrineORMMappingMappingException" error

Hi i am creating a new plugin .thats why i need to extend the leadentity so i tried to extend the leadentity like this



/



Class Lead.

/

class Liaselead extends Lead

{







/




@var DateTime

/

private $pushedToLiase;



/



@var

*/

private $liase;



/




Constructor.

/



public function __construct(){

if(is_subclass_of($this,‘MauticLeadBundleEntityLead’)){

$parent=get_parent_class($this);

$reflectionProperty = new ReflectionProperty($parent,‘id’);

$reflectionProperty->setAccessible(true);

}

parent::__construct();

}



/**



@param ORMClassMetadata $metadata

/

public static function loadMetadata(ORMClassMetadata $metadata)

{

parent::loadMetadata($metadata);

$builder->createField(‘pushedToLiase’, ‘datetime’)


columnName(‘pushed_to_liase’)

nullable()

build();

}



/



@param DateTime $date

/

public function setPushedToLiase($pushedtoliase){

$this->pushedToLiase=$pushedtoliase;

return this;

}



/




@return /DateTime pushed to liase

/

public function getPushedToLiase(){

return $this->pushedToLiase;

}



/



@set MauticPluginMauticSendToLiaseBundleEntityLiase

/

public function setLiase(MauticPluginMauticSendToLiaseBundleEntityLiase $liase=null)

{

$this->liase = $liase;

return $this;

}



/




@return MauticPluginMauticSendToLiaseBundleEntityLiase

/

public function getLiase()

{

return $this->liase;

}

}



But when i run command app/console doctrine:schema:update --force it showin me this error



[DoctrineORMMappingMappingException]

Duplicate definition of column ‘id’ on entity ‘MauticPluginMauticSendToLiaseBundleEntityLiaselead’ in a field or discrimin

ator column mapping.



please help me how i can fix this issue.

thanx in advance

Hi i am creating a new plugin .thats why i need to extend the leadentity so i tried to extend the leadentity like this

/**

Class Lead.
/
class Liaselead extends Lead
{

/**

@var DateTime
/
private $pushedToLiase;

/**

@var
*/
private $liase;

/**

Constructor.
/

public function __construct(){
if(is_subclass_of($this,‘MauticLeadBundleEntityLead’)){
$parent=get_parent_class($this);
$reflectionProperty = new ReflectionProperty($parent,‘id’);
$reflectionProperty->setAccessible(true);
}
parent::__construct();
}

/**

@param ORMClassMetadata $metadata
/
public static function loadMetadata(ORMClassMetadata $metadata)
{
parent::loadMetadata($metadata);
$builder->createField(‘pushedToLiase’, ‘datetime’)

columnName(‘pushed_to_liase’)
nullable()
build();
}

/**

@param DateTime $date
/
public function setPushedToLiase($pushedtoliase){
$this->pushedToLiase=$pushedtoliase;
return this;
}

/**

@return /DateTime pushed to liase
/
public function getPushedToLiase(){
return $this->pushedToLiase;
}

/**

@set MauticPluginMauticSendToLiaseBundleEntityLiase
/
public function setLiase(MauticPluginMauticSendToLiaseBundleEntityLiase $liase=null)
{
$this->liase = $liase;
return $this;
}

/**

@return MauticPluginMauticSendToLiaseBundleEntityLiase
/
public function getLiase()
{
return $this->liase;
}
}

But when i run command app/console doctrine:schema:update --force it showin me this error

[DoctrineORMMappingMappingException]
Duplicate definition of column ‘id’ on entity ‘MauticPluginMauticSendToLiaseBundleEntityLiaselead’ in a field or discrimin
ator column mapping.

please help me how i can fix this issue.
thanx in advance