Okay so, I'm trying to create a new object of the class "Engineering_Detail" inside my custom action "next", the problem is, even though I'm using "Use ....\Entity\Engineering_Detail"
it throws that error on the line i'm doing $detail = new Engineering_Detail();
FatalErrorException: Error: Class 'Mine\Bundle\EngMgmtBundle\Entity\Engineering_Detail' not found in C:\xampp\htdocs\EngMgmt\src\Mine\Bundle\EngMgmtBundle\Controller\EngineeringController.php line 403
The line 403 is $detail = new Engineering_Detail();
Here's the important controller bits:
<?php
namespace Mine\Bundle\EngMgmtBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Mine\Bundle\EngMgmtBundle\Entity\Engineering;
use Mine\Bundle\EngMgmtBundle\Form\EngineeringType;
use Mine\Bundle\EngMgmtBundle\Entity\Engineering_Detail;
/**
* Engineering controller.
*
* @Route("/engineering")
*/
class EngineeringController extends Controller
{
/**
* Updates a Engineering entity.
*
* @Route("/{id}/next/", name="engineering_next")
* @Method("POST")
* @Template("MineEngMgmtBundle:Engineering:update.html.twig")
*/
public function nextAction(Request $request, $id){
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('MineEngMgmtBundle:Engineering')->find($id);
$current_form = $this->getForm($entity->getStatus()->getInternalOrder());
$current_form->handleRequest($request);
$detail = new Engineering_Detail();
if ($current_form->isValid()) {
$data = $current_form->getData();
switch ($entity->getStatus()->getInternalOrder()){
case 1:
if (($data["sitesurvey"]) == 'n'){
$status = $em->getRepository('MineEngMgmtBundle:Status')->findBy(array('internalOrder' => 8));
$next_form = $this->getForm($entity->getStatus()->getInternalOrder());
}else{
$status = $em->getRepository('MineEngMgmtBundle:Status')->find(2);
$next_form = $this->getForm($entity->getStatus()->getInternalOrder());
}
break;
default:
$status = $em->getRepository('MineEngMgmtBundle:Status')->findBy(array('internalOrder' => $entity->getStatus()->getInternalOrder()+1));
$next_form = $this->getForm($entity->getStatus()->getInternalOrder());
break;
}
$detail->setEngineering($entity);
$detail->setFromStatus($entity->getStatus());
$detail->setToStatus($status);
$detail->setUpdatedDate(new \DateTime());
$detail->setUser($this->get('security.context')->getToken()->getUser());
$detail->setComments($data["comments"]);
$entity->setStatus($status);
$em->flush();
}
return array(
'entity' => $entity,
'form' => $next_form->createView()
);
}
I already checked this and verified but everything seems okay. That entity was generated using the tools inside the SF2 console. What am I doing wrong?
Note: I have already deleted cache
EDIT:
Tried with all other entities, using the same namespace and just changing the entity's name, and declaring objects, it seems the issue it's just with the entities with the _ in their name.