This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Class is not a valid entityafter moving project

Discuss installing Symfony 2 here

Class is not a valid entityafter moving project

by Gbp » Fri Oct 18, 2013 9:54 pm

Hello. After moving project to other server error appeared:

Class Acme\NBBundle\Entity\History_state is not a valid entity or mapped super class.
500 Internal Server Error - MappingException

Code seems valid and works on other machine
Code: Select all
<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Tatyana
 * Date: 02.05.12
 * Time: 11:24
 * To change this template use File | Settings | File Templates.
 */
/**
 * @ORM\Table(name="history_state")
 */
namespace Acme\NBBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
class History_state
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="State", inversedBy="history_state_id")
     * @ORM\JoinColumn(name="state_id", referencedColumnName="id")
     */
     protected $state_id;

    /**
     * @ORM\Column(type="string", length=500)
     */
    protected $description;

    /**
     * @ORM\ManyToOne(targetEntity="Offer", inversedBy="history_state_id")
     * @ORM\JoinColumn(name="offer_id", referencedColumnName="id")
     */
    protected $offer_id;
    /**
     * @var datetime $created
     *
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime", name="created_at")
     */
    protected $createdAt;
    /**
     * @var datetime $updated
     *
     * @ORM\Column(type="datetime", name="updated_at"))
     * @Gedmo\Timestampable(on="update")
     */
    protected $updatedAt;
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set description
     *
     * @param string $description
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set state_id
     *
     * @param Acme\NBBundle\Entity\State $stateId
     */
    public function setStateId(\Acme\NBBundle\Entity\State $stateId)
    {
        $this->state_id = $stateId;
    }

    /**
     * Get state_id
     *
     * @return Acme\NBBundle\Entity\State
     */
    public function getStateId()
    {
        return $this->state_id;
    }

    /**
     * Set offer_id
     *
     * @param Acme\NBBundle\Entity\Offer $offerId
     */
    public function setOfferId(\Acme\NBBundle\Entity\Offer $offerId)
    {
        $this->offer_id = $offerId;
    }

    /**
     * Get offer_id
     *
     * @return Acme\NBBundle\Entity\Offer
     */
    public function getOfferId()
    {
        return $this->offer_id;
    }

    /**
     * Set createdAt
     *
     * @param datetime $createdAt
     */
    public function setCreatedAt($createdAt)
    {

        $this->createdAt = $createdAt;

    }

    /**
     * Get createdAt
     *
     * @return datetime
     */
    public function getCreatedAt()
    {

        return $this->createdAt;
    }

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

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

    public function getCreatedAtString()
    {
        return date_format($this->createdAt, 'd-m-y H:i');
    }
    public function getName()
    {
        return $this->getStateId();
    }

}
Gbp
Junior Member
 
Posts: 1
Joined: Fri Oct 18, 2013 9:49 pm