Mapping issue Doctrine & Symfony - php

I have 3 entities where the mapping is causing some issues.
The two problems im facing are:
When i use doctrine command line schema update, it removes the column "item_type" in the item_type_field table. It looks like doctrine is not seeing this column in the YML file, while it is there.
In the Symfony application the mapping between TypeField and FieldType is not working. When i dump the FieldType of a field it returns null.
Am i missing something?
Entities and mappings:
class ItemType
{
protected $id;
protected $title;
protected $description;
protected $fields;
public function __construct(){
$this->fields = new ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function getTitle()
{
return $this->title;
}
public function setDescription($description)
{
$this->description = $description;
return $this;
}
public function getDescription()
{
return $this->description;
}
public function addField(\Aveqcms\CoreBundle\Entity\TypeField $field)
{
$field->setItemType($this);
$this->fields[] = $field;
return $this;
}
public function removeField(\Aveqcms\CoreBundle\Entity\TypeField $field)
{
$this->fields->removeElement($field);
}
public function getFields()
{
return $this->fields;
}
}
class TypeField
{
private $id;
private $item_type;
private $field_type;
public function getId()
{
return $this->id;
}
public function setItemType($itemType)
{
$this->item_type = $itemType;
return $this;
}
public function getItemType()
{
return $this->item_type;
}
public function setFieldType($fieldType)
{
$this->field_type = $fieldType;
return $this;
}
public function getFieldType()
{
return $this->field_type;
}
}
class FieldType
{
private $id;
private $title;
private $fields;
public function __construct()
{
$this->fields = new ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function getTitle()
{
return $this->title;
}
}
Mapping files:
Acme\CoreBundle\Entity\ItemType:
type: entity
table: item_type
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
title:
type: string
length: 255
description:
type: string
length: 255
oneToMany:
fields:
targetEntity: TypeField
mappedBy: item_type
cascade: [persist]
Acme\CoreBundle\Entity\TypeField:
type: entity
table: item_type_field
id:
id:
type: integer
generator: { strategy: AUTO }
manyToOne:
field_type:
targetEntity: FieldType
inversedBy: fields
joinColumn:
name: field_type
referencedColumnName: id
manyToOne:
item_type:
targetEntity: ItemType
inversedBy: fields
joinColumn:
name: item_type
referencedColumnName: id
Acme\CoreBundle\Entity\FieldType:
type: entity
table: field_type
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
title:
type: text
oneToMany:
fields:
targetEntity: TypeField
mappedBy: field_type

In TypeField you have manyToOne repeated twice. The second one overrides the first one whcih is why doctrine is not seeing it.
Acme\CoreBundle\Entity\TypeField:
type: entity
table: item_type_field
id:
id:
type: integer
generator: { strategy: AUTO }
manyToOne:
field_type:
targetEntity: FieldType
inversedBy: fields
joinColumn:
name: field_type
referencedColumnName: id
#manyToOne: *** Get rid of this ***
item_type:
targetEntity: ItemType
inversedBy: fields
joinColumn:
name: item_type
referencedColumnName: id
This may or may not fix all your issues. And it certainly does not address the issue of your very confusing naming conventions.

Related

The mappings App\Entity\xx and App\Entity\are inconsistent with each other

I'm new on Symfony 6 and i've got problem with 2 of my entities.
App\Entity\Mission :
The mappings App\Entity\Mission#idtagmissionassign and App\Entity\Tag#missionstag are inconsistent with each other.
App\Entity\Tag :
The association App\Entity\Tag#missionstag refers to the inverse side field App\Entity\Mission#tags which does not exist.
This is the relation betewen the 2 entities :
DB
This is Mission entity
<?php
namespace App\Entity;
use App\Repository\MissionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MissionRepository::class)]
#[ORM\Table(name: 'mission')]
class Mission
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $titlemission = null;
#[ORM\Column(length: 255)]
private ?string $descriptionmission = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $onsetdate = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $deadline = null;
#[ORM\Column]
private ?int $budgetmission = null;
/*#[ORM\Column(length: 255)]
private ?string $codeapemission = null;*/
#[ORM\Column(length: 255)]
private ?string $prioritymission = null;
#[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'missionstag',cascade: ['persist'])]
#[ORM\JoinTable(name:'mission_tag')]
private Collection $idtagmissionassign;
#[ORM\ManyToOne(inversedBy: 'missions')]
#[ORM\JoinColumn(nullable: false)]
private ?User $iduser = null;
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'missionsassign')]
private Collection $idmissionassign;
#[ORM\Column(length: 100)]
private ?string $remote = null;
public function __construct()
{
$this->idtagmissionassign = new ArrayCollection();
$this->idmissionassign = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitlemission(): ?string
{
return $this->titlemission;
}
public function setTitlemission(string $titlemission): self
{
$this->titlemission = $titlemission;
return $this;
}
public function getDescriptionmission(): ?string
{
return $this->descriptionmission;
}
public function setDescriptionmission(string $descriptionmission): self
{
$this->descriptionmission = $descriptionmission;
return $this;
}
public function getOnsetdate(): ?\DateTimeInterface
{
return $this->onsetdate;
}
public function setOnsetdate(\DateTimeInterface $onsetdate): self
{
$this->onsetdate = $onsetdate;
return $this;
}
public function getDeadline(): ?\DateTimeInterface
{
return $this->deadline;
}
public function setDeadline(\DateTimeInterface $deadline): self
{
$this->deadline = $deadline;
return $this;
}
public function getBudgetmission(): ?int
{
return $this->budgetmission;
}
public function setBudgetmission(int $budgetmission): self
{
$this->budgetmission = $budgetmission;
return $this;
}
/*public function getCodeapemission(): ?string
{
return $this->codeapemission;
}
public function setCodeapemission(string $codeapemission): self
{
$this->codeapemission = $codeapemission;
return $this;
}*/
public function getPrioritymission(): ?string
{
return $this->prioritymission;
}
public function setPrioritymission(string $prioritymission): self
{
$this->prioritymission = $prioritymission;
return $this;
}
/**
* #return Collection<int, tag>
*/
public function getIdtagmissionassign(): Collection
{
return $this->idtagmissionassign;
}
public function addIdtagmissionassign(tag $idtagmissionassign): self
{
if (!$this->idtagmissionassign->contains($idtagmissionassign)) {
$this->idtagmissionassign->add($idtagmissionassign);
}
return $this;
}
public function removeIdtagmissionassign(tag $idtagmissionassign): self
{
$this->idtagmissionassign->removeElement($idtagmissionassign);
return $this;
}
public function getIduser(): ?user
{
return $this->iduser;
}
public function setIduser(?user $iduser): self
{
$this->iduser = $iduser;
return $this;
}
/**
* #return Collection<int, user>
*/
public function getIdmissionassign(): Collection
{
return $this->idmissionassign;
}
public function addIdmissionassign(user $idmissionassign): self
{
if (!$this->idmissionassign->contains($idmissionassign)) {
$this->idmissionassign->add($idmissionassign);
}
return $this;
}
public function removeIdmissionassign(user $idmissionassign): self
{
$this->idmissionassign->removeElement($idmissionassign);
return $this;
}
public function getRemote(): ?string
{
return $this->remote;
}
public function setRemote(string $remote): self
{
$this->remote = $remote;
return $this;
}
public function __toString(){
return $this->titlemission;
}
}
This is Tag entity :
<?php
namespace App\Entity;
use App\Repository\TagRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: TagRepository::class)]
class Tag
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 100)]
#[Assert\NotBlank]
#[Assert\Length(min:2)]
#[Assert\Valid]
private ?string $nomtag = null;
#[ORM\ManyToMany(targetEntity: Mission::class, mappedBy: 'tags')]
#[ORM\JoinTable(name:'mission_tag')]
private Collection $missionstag;
public function __construct()
{
$this->missionstag = new ArrayCollection();
}
// #[ORM\ManyToMany(targetEntity: Mission::class, inversedBy:"$idtagmissionassign")]
// private $genusScientists;
public function getId(): ?int
{
return $this->id;
}
public function getNomtag(): ?string
{
return $this->nomtag;
}
public function setNomtag(string $nomtag): self
{
$this->nomtag = $nomtag;
return $this;
}
/**
* #return Collection<int, Mission>
*/
public function getMissions(): Collection
{
return $this->missionstag;
}
public function addMission(Mission $mission): self
{
if (!$this->missionstag->contains($mission)) {
$this->missionstag->add($mission);
$mission->addTag($this);
}
return $this;
}
public function removeMission(Mission $mission): self
{
if ($this->missionstag->removeElement($mission)) {
$mission->removeTag($this);
}
return $this;
}
public function __toString(): string
{
return $this->nomtag;
}
}
Do you have an idea to help me to solve this problem ?
Many thanks
Change the mappedby and inversedby with no effect.
Trying some stuff follow internet guideline with no success.
Tag's property missionstag claims, that it is mapped by Missions's property "tags", but there is no such property, instead you have idtagmissionassign. (Side note: Your property names are bad, because they look like database columns, but you're using an ORM.
The first question you would have to ask yourself: will you need additional columns on your many-to-many table. If the answer is yes, ORM\ManyToMany isn't even the right fit. If the answer is no, it fits.
The case where it fits:
Mission should have the following property + attributes:
#[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'missions', cascade: ['persist'])]
#[ORM\JoinTable(name: 'mission_tag')]
private Collection $tags;
and the Tag should have the following property + attributes:
#[ORM\ManyToMany(targetEntity: Mission::class, mappedBy: 'tags', cascade: ['persist'])]
#[ORM\JoinTable(name: 'mission_tag')] // <- is this the actual table name?
private Collection $missions;
the mappedBy and inversedBy must match the property name on the other entity, respectively.
If your mission_tag table doesn't have columns mission_id and tag_id, you might have to explicitly name the columns via the JoinColumn and InverseJoinColumn Attibutes.
For the case, where it doesn't fit, you would have to have an actual entity MissionTags with OneToMany on Mission/Tag that both reference it, and reversed ManyToOnes on MissionTags. But that wasn't what you asked.
BC\InventoryBundle\Entity\ProductRecipe:
type: entity
table: ProductRecipe
repositoryClass: BC\InventoryBundle\Entity\ProductRecipeRepository
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
amount: // Previously "ammount"
type: decimal
presision: 10
scale: 2
manyToOne:
products:
targetEntity: Product
// "Products" is named correctly but recipe is singular
// so for the sake of uniformity
inversedBy: recipes
joinColumn:
name: product_id
referencedColumnName: id
recipes:
targetEntity: Recipe
// Previously "Recipes", incorrect entity name
inversedBy: products
joinColumn:
name: recipe_id
referencedColumnName: id

Create form based on Entity from array collection

Trying to create a simple web shop with symfony and doctrine. Problem is: I don't know how to create the order form which should have the ability to select/set the quantity of each product. I think I need 3 Entities Product, Order and OrderPosition.
Where Product has a price and title. Order knows which User made an Order and when but relevant in this case is an Order has OrderPositions and the OrderPositions have the property quantity. So the OrderPosition knows which Product has been ordered how many times.
I'm not sure if the mapping/relation of those entities is correct so I will show them here:
Product:
class Product
{
private $id;
private $price;
private $title;
private $orderPositions;
public function __construct()
{
$this->orderPositions = new ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function setPrice($price)
{
$this->price = $price;
return $this;
}
public function getPrice()
{
return $this->price;
}
public function setTitle($title)
{
$this->title = $title;
return $this;
}
public function getTitle()
{
return $this->title;
}
public function getOrderPositions()
{
return $this->orderPositions;
}
public function addOrderPosition(OrderPosition $orderPosition)
{
$this->orderPositions[] = $orderPosition;
if ($orderPosition->getProduct() !== $this) {
$orderPosition->setProduct($this);
}
return $this;
}
}
Order:
class Order
{
private $id;
private $orderPositions;
public function __construct()
{
$this->orderPositions = new ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function getOrderPositions()
{
return $this->orderPositions;
}
public function addOrderPosition(OrderPosition $orderPosition)
{
$this->orderPositions[] = $orderPosition;
if ($orderPosition->getOrder() !== $this) {
$orderPosition->setOrder($this);
}
return $this;
}
}
OderPosition:
class OrderPosition
{
private $id;
private $quantity;
private $order;
private $product;
public function getId()
{
return $this->id;
}
public function getQuantity()
{
return $this->quantity;
}
public function setQuantity($quantity)
{
$this->quantity = $quantity;
}
public function getOrder()
{
return $this->order;
}
public function setOrder(Order $order)
{
$this->order = $order;
if ($order->getOrderPositions() !== $this) {
$order->addOrderPosition($this);
}
return $this;
}
public function getProduct()
{
return $this->product;
}
public function setProduct(Product $product)
{
$this->product = $product;
if ($product->getOrderPositions() !== $this) {
$product->addOrderPosition($this);
}
return $this;
}
}
The mapping files:
Product:
MyBundle\Entity\Product:
type: entity
table: product
repositoryClass: MyBundle\Repository\ProductRepository
oneToMany:
orderPositions:
targetEntity: OrderPosition
mappedBy: product
cascade: [ "persist" ]
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
price:
type: float
title:
type: string
length: 255
column: title
lifecycleCallbacks: { }
Order:
MyBundle\Entity\Order:
repositoryClass: MyBundle\Repository\OrderRepository
type: entity
table: order
oneToMany:
orderPositions:
targetEntity: OrderPosition
mappedBy: order
cascade: [ "persist" ]
id:
id:
type: integer
id: true
generator:
strategy: AUTO
lifecycleCallbacks: { }
OrderPosition:
MyBundle\Entity\OrderPosition:
repositoryClass: MyBundle\Repository\OrderPositionRepository
type: entity
table: order_position
manyToOne:
order:
targetEntity: Order
inversedBy: orderPositions
joinColumn:
name: order_id
referencedColumnName: id
product:
targetEntity: Product
inversedBy: orderPositions
joinColumn:
name: product_id
referencedColumnName: id
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
quantity:
type: integer
lifecycleCallbacks: { }
And the controller which should create the form looks like:
$order = new Order();
$form = $this->createFormBuilder($order)
->add('quantity', OrderPositionType::class)
->add('save', SubmitType::class, array('label' => 'Order'))
->getForm();
and last the OrderPositionType
class OrderPositionType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('quantity', IntegerType::class);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'MyBundle\Entity\OrderPosition'
));
}
}
Now, the Question is: How can I get the Order form to create a quantity input field for every Product?
You define types like this:
OrderPositionType:
class OrderPositionType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('quantity');
}
}
OrderType:
class OrderType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('orderPositions', CollectionType::class, [
'entry_type' => OrderPositionType::class,
'allow_add' => false,
]);
// Other fields then...
}
}
and your controller:
// $products = list of products user has selected. You already have it
$order = new Order();
foreach ($products as $product) {
$orderPosition = new OrderPosition($order);
$orderPosition->setProduct($product);
$orderPosition->setQuantity(1); // default quantity, just my guess
}
$form = $this->createForm(OrderType::class, $order);

Doctrine2 PDO Exception Integrity violation 1048 - Fixtures loading - YML

I've the following entity Category defined in YML with bi-directional many-to-many relationship. When i try to load the fixtures data in the corresponding database via doctrine:fixtures:load i receive a PDO Exception error 1048 about integrity violation that the 'name' field can't be null
# src/tuto/JobeetBundle/Resources/config/doctrine/Category.orm.yml
tuto\JobeetBundle\Entity\Category:
type: entity
repositoryClass: tuto\JobeetBundle\Repository\CategoryRepository
table: category
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
length: 255
unique: true
slug:
type: string
length: 255
unique: true
oneToMany:
jobs:
targetEntity: Job
mappedBy: category
manyToMany:
affiliates:
targetEntity: Affiliate
mappedBy: categories
lifecycleCallbacks:
prePersist: [setSlugValue]
preUpdate: [setSlugValue]
/**
* #var string
*/
private $slug;
public
function setSlug($slug) {
$this - > slug = $slug;
return $this;
}
/**
* Get slug
*
* #return string
*/
public
function getSlug() {
return $this - > slug;
}
/**
* #ORM\PrePersist
* #ORM\PreUpdate
*/
public
function setSlugValue() {
$sl = new Slugify();
$this - > slug = $sl - > slugify($this - > getName());
}
/**
* #ORM\PrePersist
* #ORM\PreUpdate
*/
public
function prePersist() {
$this - > slug = '';
}
May you find the fixture here
You have a typo $qualityManager object on line 20:
Here:
$qualityManager = new Category();
$technician->setName("Quality Manager"); // <-- Wrong object
Try this:
$qualityManager = new Category();
$qualityManager->setName("Quality Manager");
Hope this help

Symfony not finding a custom repository

I have used Symfony's entity generation facilities to create Entities (e.g., Person and Destination) as well as custom Entity Repositories (e.g., PersonRepository and DestinationRepository). The Entities were generated against orm.yml files such as Person.orm.yml and Destination.orm.yml. The DestinationRepository class works great, but my PersonController can never seem to find any methods in the PersonRepository class. The error I'm getting is:
UndefinedMethodException: Attempted to call method "findMe" on class "Me\MyBundle\Entity\Person" in C:\xampp55\htdocs\symtran2\src\Me\MyBundle\Controller\PersonController.php line 124.
I put a little "findMe()" method in the Person entity, and it works, but when I move it to PersonRepository.php, I get the above error. This is driving me crazy, and Google informs me that I'm not the only person to have this problem.
Here is my Destination.org.yml file:
Ginsberg\TransportationBundle\Entity\Destination:
type: entity
repositoryClass: Ginsberg\TransportationBundle\Entity\DestinationRepository
table: destination
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
unique: true
nullable: false
is_active:
type: boolean
nullable: true
manyToOne:
program:
targetEntity: Program
inversedBy: destinations
joinColumn:
name: program_id
referencedColumnName: id
oneToMany:
reservations:
targetEntity: Reservation
mappedBy: destination
Here is my Person.orm.yml file:
Ginsberg\TransportationBundle\Entity\Person:
type: entity
repositoryClass: Ginsberg\TransportationBundle\Entity\PersonRepository
table: person
id:
id:
type: integer
generator:
strategy: AUTO
fields:
firstName:
type: string
length: 100
lastName:
type: string
length: 100
uniqname:
type: string
length: 25
unique: true
phone:
type: string
length: 20
nullable: true
status:
type: string
length: 100
nullable: true
dateApproved:
type: datetime
nullable: true
isTermsAgreed:
type: boolean
nullable: true
hasUnpaidTicket:
type: smallint
nullable: true
created:
type: datetime
modified:
type: datetime
nullable: true
oneToMany:
reservations:
targetEntity: Reservation
mappedBy: person
manyToOne:
program:
targetEntity: Program
inversedBy: persons
joinColumn:
name: program_id
referencedColumnName: id
nullable: false
lifecycleCallbacks:
prePersist: [ setCreatedValue ]
preUpdate: [ setModifiedValue ]
Here is my DestinationRepository file:
<?php
namespace Ginsberg\TransportationBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* DestinationRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class DestinationRepository extends EntityRepository
{
public function findByProgramsSortedByProgram($param)
{
$dql = 'SELECT d, p FROM GinsbergTransportationBundle:Destination d JOIN d.program p ORDER BY p.name ASC, d.name ASC';
$query = $this->getEntityManager()->createQuery($dql);
try {
return $query->getResult();
} catch (\Doctrine\ORM\NoResultException $ex) {
return null;
}
}
}
And here is my PersonRepository.php file:
<?php
namespace Ginsberg\TransportationBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PersonRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PersonRepository extends EntityRepository
{
public function findMe() {
print_r("Here");
}
public function findByPendingSortedByCreated($fakeParam)
{
$dql = "SELECT p, prog FROM GinsbergTransportationBundle:Person p JOIN d.program prog WHERE p.status = 'pending' ORDER BY p.created ASC";
$query = getEntityManager()->createQuery($dql);
try {
return $query->getResult();
} catch (\Doctrine\ORM\NoResultException $ex) {
return null;
}
}
}
I'm using YAML for Doctrine but annotations in my controllers.
Here's the controller method that tries to call the findMe() method:
/** Finds and displays a Person entity.
*
* #Route("/{id}", name="person_show")
* #Method("GET")
* #Template()
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('GinsbergTransportationBundle:Person')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Person entity.');
}
$entity->findMe();
//$entity->testMe();
$deleteForm = $this->createDeleteForm($id);
return array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
);
}
I would be beyond grateful for any assistance in sorting this out.
you are calling findMe on the entity found by id, you have to call it on the repository
$repository = $em->getRepository('GinsbergTransportationBundle:Person');
$found = $repository->findMe();

Symfony2 - target-entity cannot be found

These are the entities:
Objective.php
namespace Foo\BSCBundle\Entity;
class Objective{
protected $id;
protected $name;
protected $perspective;
...
}
Objective.orm.yml
Foo\BSCBundle\Entity\Objective:
type: entity
table: master.objectives
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
manyToOne:
perspective:
targetEntity: Pespective
inversedBy: objectives
joinColumn:
name: perspective_id
referencesColumn: id
Perspective.php
use Doctrine\Common\Collections\ArrayCollection;
namespace Foo\BSCBundle\Entity;
class Perspective {
protected $id;
protected $objectives;
...
}
Perspective.orm.yml
Foo\BSCBundle\Entity\Perspective:
type: entity
table: perspectives
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
length: 100
oneToMany:
objectives:
targetEntity: Objective
mappedBy: Perspective
DefaultController.php
public function indexAction($name)
{
$perspective = $this->getDoctrine()
->getRepository('FooBSCBundle:Objective')
->find(1);
$params = array('name' => $name, 'perspective' => $perspective);
return $this->render('FooBSCBundle:Default:index.html.twig', $params);
}
In my browser I get the error:
The target-entity Foo\BSCBundle\Entity\Pespective cannot be found
in 'Foo\BSCBundle\Entity\Objective#perspective'. 500 Internal
Server Error - MappingException
What am I doing wrong?

Categories