Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7952307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:49:20+00:00 2026-06-04T02:49:20+00:00

I have this entity (Registro): <?php namespace Gitek\RegistroBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** *

  • 0

I have this entity (Registro):

<?php

namespace Gitek\RegistroBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Gitek\RegistroBundle\Entity\Registro
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Gitek\RegistroBundle\Entity\RegistroRepository"))
 */
class Registro
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var datetime $fecha
     *
     * @ORM\Column(name="fecha", type="datetime")
     */
    private $fecha;

    /**
     * @var smallint $comenzado
     *
     * @ORM\Column(name="comenzado", type="smallint", nullable=true)
     */
    private $comenzado;

    /**
     * @var smallint $completado
     *
     * @ORM\Column(name="completado", type="smallint", nullable=true)
     */
    private $completado;

   /**
     * @var datetime $created_at
     *
     * @ORM\Column(name="created_at", type="datetime")
     */
    private $created_at;

    /**
     * @var datetime $updated_at
     *
     * @ORM\Column(name="updated_at", type="datetime")
     */
    private $updated_at;

    /** @ORM\ManyToOne(targetEntity="Gitek\UsuarioBundle\Entity\Usuario") */
    protected $usuario;

    /** @ORM\ManyToOne(targetEntity="Gitek\HotelBundle\Entity\Tipotarea") */
    protected $tipotarea;

    /** @ORM\ManyToOne(targetEntity="Gitek\HotelBundle\Entity\Habitacion") */
    protected $habitacion;

    /** @ORM\ManyToOne(targetEntity="Gitek\RegistroBundle\Entity\Master") */
    protected $master;

    /**
     * @ORM\ManyToMany(targetEntity="Gitek\HotelBundle\Entity\Incidencia", inversedBy="registros")
     * @ORM\JoinTable(name="incidencia_registro",
     *      joinColumns={@ORM\JoinColumn(name="registro_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="incidencia_id", referencedColumnName="id")}
     * )
     */
    protected $incidencias;

    public function __construct()
    {
        $this->created_at = new \DateTime();
        $this->updated_at = new \DateTime();
    }

    // public function __toString()
    // {
    //     return $this->getNombre();
    // }




    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set fecha
     *
     * @param datetime $fecha
     */
    public function setFecha($fecha)
    {
        $this->fecha = $fecha;
    }

    /**
     * Get fecha
     *
     * @return datetime 
     */
    public function getFecha()
    {
        return $this->fecha;
    }

    /**
     * Set comenzado
     *
     * @param smallint $comenzado
     */
    public function setComenzado($comenzado)
    {
        $this->comenzado = $comenzado;
    }

    /**
     * Get comenzado
     *
     * @return smallint 
     */
    public function getComenzado()
    {
        return $this->comenzado;
    }

    /**
     * Set completado
     *
     * @param smallint $completado
     */
    public function setCompletado($completado)
    {
        $this->completado = $completado;
    }

    /**
     * Get completado
     *
     * @return smallint 
     */
    public function getCompletado()
    {
        return $this->completado;
    }

    /**
     * Set created_at
     *
     * @param datetime $createdAt
     */
    public function setCreatedAt($createdAt)
    {
        $this->created_at = $createdAt;
    }

    /**
     * Get created_at
     *
     * @return datetime 
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    /**
     * Set updated_at
     *
     * @param datetime $updatedAt
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updated_at = $updatedAt;
    }

    /**
     * Get updated_at
     *
     * @return datetime 
     */
    public function getUpdatedAt()
    {
        return $this->updated_at;
    }

    /**
     * Set usuario
     *
     * @param Gitek\UsuarioBundle\Entity\Usuario $usuario
     */
    public function setUsuario(\Gitek\UsuarioBundle\Entity\Usuario $usuario)
    {
        $this->usuario = $usuario;
    }

    /**
     * Get usuario
     *
     * @return Gitek\UsuarioBundle\Entity\Usuario 
     */
    public function getUsuario()
    {
        return $this->usuario;
    }

    /**
     * Set tipotarea
     *
     * @param Gitek\HotelBundle\Entity\Tipotarea $tipotarea
     */
    public function setTipotarea(\Gitek\HotelBundle\Entity\Tipotarea $tipotarea)
    {
        $this->tipotarea = $tipotarea;
    }

    /**
     * Get tipotarea
     *
     * @return Gitek\HotelBundle\Entity\Tipotarea 
     */
    public function getTipotarea()
    {
        return $this->tipotarea;
    }

    /**
     * Set habitacion
     *
     * @param Gitek\HotelBundle\Entity\Habitacion $habitacion
     */
    public function setHabitacion(\Gitek\HotelBundle\Entity\Habitacion $habitacion)
    {
        $this->habitacion = $habitacion;
    }

    /**
     * Get habitacion
     *
     * @return Gitek\HotelBundle\Entity\Habitacion 
     */
    public function getHabitacion()
    {
        return $this->habitacion;
    }

    /**
     * Add incidencias
     *
     * @param Gitek\HotelBundle\Entity\Incidencia $incidencias
     */
    public function addIncidencia(\Gitek\HotelBundle\Entity\Incidencia $incidencias)
    {
        $this->incidencias[] = $incidencias;
    }

    /**
     * Get incidencias
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getIncidencias()
    {
        return $this->incidencias;
    }
}

I wanted to save multiple data on a row, so I created a new Entity with only an array propery like this (Master):

<?php

namespace Gitek\RegistroBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

class Master
{

    /** @ORM\OneToMany(targetEntity="Gitek\HotelBundle\Entity\Habitacion", mappedBy="master") */
    protected $registros;

    public function __construct()
    {
        $this->registros = new ArrayCollection();
    }

    public function getRegistros()
    {
        return $this->registros;
    }

    public function setRegistros(ArrayCollection $registros)
    {
        $this->registros = $registros;
    }
}

I created my MasterType like this:

<?php

namespace Gitek\RegistroBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Doctrine\ORM\EntityRepository;

class MasterType extends AbstractType
{
    public function buildForm(FormBuilder $builder, array $options)
    {

        $builder
        ->add('registros', 'collection', array(
                'type' => new RegistroType(),
                'allow_add' => true,
                'by_reference' => true,
            ));
    }

    public function getDefaultOptions(array $options)
    {
        return array(
            'data_class' => 'Gitek\RegistroBundle\Entity\Master'
        );
    }

    public function getName()
    {
        return 'master';
    }
}

And this is my controller:

public function asignarAction()
{
    $master = new Master();
    $request = $this->getRequest();
    $form   = $this->createForm(new MasterType(), $master);

    if ('POST' === $request->getMethod()) {
        $form->bindRequest($request);

        if ($form->isValid()) {

            $em = $this->getDoctrine()->getEntityManager();
            $em->persist($master);
            $em->flush();

            return $this->redirect($this->generateUrl('recepcion_asignar'));
        }else {
            print_r("ezez");
            print_r($form->getErrors());
        }
    } else {

    }
    return $this->render('RegistroBundle:Recepcion:asignar.html.twig', array(
        'registro'  => $master,
        'form'      => $form->createView()
    ));
}

The form works ok, and I see the data is submited correctly but it is not persisted, I´m getting this error all the time:

Class Gitek\RegistroBundle\Entity\Master is not a valid entity or mapped super class.

I think that the problem is within de Master entity.

Any help or clue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:49:22+00:00Added an answer on June 4, 2026 at 2:49 am

    You missed the @Entity annotation on your Master class, you will also need a master table on your database for this to work.

    If you don’t want to create the master table, then you can skip the @Entity annotation, but you can not persist master. Instead you would have to iterate through the collection and persist only the entities in the array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this file: #src/Jander/JanderBundle/resources/config/doctrine/metadata/orm/ Propuestas.orm.yml Propuestas: type: entity table: propuestas fields: id: id:
I use Entity Framework and have this entity mapping: Parent - Child 1 (ActiveInd
I have this Entity called 'Operation': @Entity @Table(name=operation) public class Operation implements Serializable {
I have this code @Entity @Table(name = picture) public class Picture implements Serializable {
My situation is this: We have a superclass, MyAbstractEntity @Entity @Table(name = MyTable) @Inheritance(strategy
I'm using Doctrine 2 ORM and I have this problem. I have three Entities,
suppose that I have this RDBM table ( Entity-attribute-value_model ): col1: entityID col2: attributeName
I have this VHDL code library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity
Say I have this class: @Entity @Table(name=PICTURE) public class Picture{ private String category1, category2;
I have this class @Entity @Table(name = DB.APPL_SESSION) @AttributeOverrides({@AttributeOverride(name = id, column = @Column(name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.