I'm trying to apply this tutorial to my project, but I don't get it working. Everytime I try to update my schema i get an error: Fatal error: Cannot redeclare class Rueckgrat\App\Models\ProjectSetting in.....
I have 2 files. The first one is ProjectSetting.php
namespace Rueckgrat\App\Models;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping AS ORM;
/**
* @ORM\Entity()
* @ORM\Table(name="project_setting")
* @ORM\HasLifecycleCallbacks()
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="is_production", type="integer")
* @ORM\DiscriminatorMap({"0" = "ProjectCalculation", "1" = "ProjectSetting"})
*/
class ProjectSetting
{
// More code here
}
The second one is ProjectCalculation.php
namespace Rueckgrat\App\Models;
use Doctrine\ORM\Mapping AS ORM;
/**
* @ORM\Entity
*/
class ProjectCalculation extends \Rueckgrat\App\Models\ProjectSetting
{
....
}
Any help or hint appreciated.
Update:
Full error message: Fatal error: Cannot redeclare class Rueckgrat\App\Models\ProjectSetting in /Applications/MAMP/htdocs/Rueckgrat/app/models/ProjectSetting.php on line 17
I just tried the example from the Doctrine documentation, just splited in two entity files and it is not working. Then i copied the ProjectCalculation class in the file of ProjectSetting and it is working.
Update 2:
I can't update my Schema, but it is saving the correct discriminator to the project_setting table, when i save an ProjectCalculation Entity.
This can be the problem with PHP accelerator on your machine. Please turn off APC or XCache (whatever you have there), restart PHP/Apache and try again.