From what I understand, you're trying to convert an entity of type Posto
to an entity of type Maquina
, right?
In your createAction
method you are instantiating an entity of type Maquina
without filling in all its values. And the table exists that some values are non-null, as it accuses the error you posted.
In my opinion, the method should look something like this:
public function createAction($id)
{
$posto = $this->getDoctrine()->getPostoRepository()->find($id);
$maquina = new Maquina();
$maquina->setNumero( $posto->getNumero() );
$maquina->setDescricao( $posto->getNumero() );
$maquina->setEndereco( $posto->getNumero() );
$maquina->setestacao( $posto->getNumero() );
$maquina->setProtocolo( $posto->getNumero() );
$maquina->setAtivo( $posto->getNumero() );
$maquina->setLer( $posto->getNumero() );
$maquina->setDtype('maquina');
$this->getDoctrine()->getManager()->persist($maquina);
$this->getDoctrine()->getManager()->flush();
return $this->redirect($this->generateUrl('manutencao_maquina', array('id' => $id)));
}