I'm trying to persist some data to MongoDB with Docrtrine (symfony2.1). Here are my entities:
// src/Acme/ReportsBundle/Entity/ReportCore.php
namespace Acme\ReportsBundle\Entity;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Doctrine\Common\Collections\ArrayCollection;
/**
* #MongoDB\Document(collection="registeredReports")
*/
class ReportCore {
/**
* #MongoDB\Id
*/
protected $id;
/**
* #MongoDB\String
*/
protected $title;
/**
* #MongoDB\String
*/
protected $description;
/**
* #MongoDB\String
*/
protected $reference;
/**
* #MongoDB\Date
*/
protected $created;
/**
* #MongoDB\Date
*/
protected $createdBy;
/**
* #MongoDB\EmbedMany(targetDocument="ReportFields")
*/
protected $fields = array();
public function __construct () {
$this->fields = new ArrayCollection();
}
// Setters, getters
}
Here's embedded document:
// src/Acme/ReportsBundle/Entity/ReportFields.php
namespace Acme\ReportsBundle\Entity;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
* #MongoDB\EmbeddedDocument
*/
class ReportFields {
/**
* #MongoDB\Id
*/
protected $id;
/**
* #MongoDB\String
*/
protected $title;
/**
* #MongoDB\String
*/
protected $description;
/**
* #MongoDB\String
*/
protected $name;
/**
* #MongoDB\String
*/
protected $type;
//Setters-getters...
}
and here is controller:
// src/Acme/ReportsBundle/Controller/ReportsController.php
namespace Acme\ReportsBundle\Controller;
use Acme\ReportsBundle\Entity\ReportCore;
use Acme\ReportsBundle\Entity\ReportFields;
use Acme\ReportsBundle\Form\Type\ReportCoreType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ReportsController extends Controller {
public function newAction (Request $request) {
$report = new ReportCore();
$fields1 = new ReportFields();
$report->getFields()->add($fields1);
$form = $this->createForm(new ReportCoreType(), $report);
if ( $request->isMethod('POST') ) {
$form->bind($request);
if ( $form->isValid() ) {
$dm = $this->get('doctrine_mongodb')->getManager();
$dm->persist($report);
$dm->flush();
}
}
return $this->render('AcmeReportsBundle:Report:new.html.twig', array(
'form' => $form->createView()
));
}
My problem is - when I try to persist data to database, I get
The class 'Acme\ReportsBundle\Entity\ReportCore' was not found in the chain configured namespaces FOS\UserBundle\Document
As I'm quite new to Symfony and Doctrine - I can't figure out what it has to do with FOSUserBundle, and what am I doing wrong.
Your MongoDb-Schemas should be within the Document namespace
namespace Acme\ReportsBundle\Document;
Related
I need implement FOSUserBundle using ORM database and FOSMessageBundle using MongoDB (ODM database). Is it posible?
I configure FOSUserBundle using ORM and works.
I am triying to configure FOSMessageBundle using the documentation https://github.com/FriendsOfSymfony/FOSMessageBundle/blob/master/Resources/doc/01b-odm-models.md the problem it is here:
/**
* #MongoDB\ReferenceOne(targetDocument="Acme\UserBundle\Document\User")
*/
protected $sender;
I don´t have Acme\UserBundle\Document\User, I have Acme\UserBundle\Entity\User .
If I put Acme\UserBundle\Entity\User don´t work.
I try to use http://doctrine-mongodb-odm.readthedocs.org/en/latest/cookbook/blending-orm-and-mongodb-odm.html but I need help.
Another option it is create a duplicate User table in MongoDB but I don't know how I can do this.
Thanks for your solution Nawdal Serrar.
I read the documentation and try this. Don`t work, can you help me please?
Message.php
/**
* #MongoDB\Document
*/
class Message extends BaseMessage{
/**
* #MongoDB\Id
*/
protected $id;
/**
* #MongoDB\EmbedMany(targetDocument="xxx\MensajeriaBundle\Document\MessageMetadata")
*/
protected $metadata;
/**
* #MongoDB\ReferenceOne(targetDocument="xxx\MensajeriaBundle\Document\Thread")
*/
protected $thread;
/**
* #Gedmo\ReferenceMany(type="entity", class="xxx\WebBundle\Entity\usuarios", mappedBy="senderMongo")
*/
protected $sender;
public function __construct()
{
$this->metadata = new \Doctrine\Common\Collections\ArrayCollection();
$this->createdAt = new \DateTime();
}
}
MessageMetadata.php
/**
* #ODM\EmbeddedDocument
*/
class MessageMetadata extends BaseMessageMetadata
{
/**
* #Gedmo\ReferenceMany(type="entity", class="xxx\WebBundle\Entity\usuarios", mappedBy="participantMesssageMongo")
*/
protected $participant;
}
Thread.class
/**
* #MongoDB\Document
*/
class Thread extends BaseThread
{
/**
* #MongoDB\Id
*/
protected $id;
/**
* #MongoDB\ReferenceMany(targetDocument="xxx\MensajeriaBundle\Document\Message")
*/
protected $messages;
/**
* #MongoDB\EmbedMany(targetDocument="xxx\MensajeriaBundle\Document\ThreadMetadata")
*/
protected $metadata;
/**
* #Gedmo\ReferenceMany(type="entity", class="xxx\WebBundle\Entity\usuarios", mappedBy="participantsMongo")
*/
protected $participants;
/**
* #Gedmo\ReferenceMany(type="entity", class="xxx\WebBundle\Entity\usuarios", mappedBy="createdByMongo")
*/
protected $createdBy;
}
ThreadMetadata.php
/**
* #ODM\EmbeddedDocument
*/
class ThreadMetadata extends BaseThreadMetadata
{
/**
* #Gedmo\ReferenceMany(type="entity", class="xxx\WebBundle\Entity\usuarios", mappedBy="participantThreatMongo")
*/
protected $participant;
}
usuarios.php
/**
* #Gedmo\ReferenceOne(type="document", class="xxx\MensajeriaBundle\Document\Message", inversedBy="sender", identifier="senderId")
*/
private $senderMongo;
/**
* #ORM\Column(type="string", nullable=true)
*/
private $senderId;
/**
* #Gedmo\ReferenceOne(type="document", class="xxx\MensajeriaBundle\Document\MessageMetadata", inversedBy="participant", identifier="participantMessageId")
*/
private $participantMessageMongo;
/**
* #ORM\Column(type="string", nullable=true)
*/
private $participantMessageId;
/**
* #Gedmo\ReferenceOne(type="document", class="xxx\MensajeriaBundle\Document\Thread", inversedBy="participants", identifier="participantsId")
*/
private $participantsMongo;
/**
* #ORM\Column(type="string", nullable=true)
*/
private $participantsId;
/**
* #Gedmo\ReferenceOne(type="document", class="xxx\MensajeriaBundle\Document\Thread", inversedBy="createdBy", identifier="createdById")
*/
private $createdByMongo;
/**
* #ORM\Column(type="string", nullable=true)
*/
private $createdById;
/**
* #Gedmo\ReferenceOne(type="document", class="xxx\MensajeriaBundle\Document\ThreadMetadata", inversedBy="participant", identifier="participantThreadId")
*/
private $participantThreadMongo;
/**
* #ORM\Column(type="string", nullable=true)
*/
private $participantThreadId;
This is what you need, you can reference relationships between ODM and ORM entities https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/references.md
I am using symfony2 and doctrine.
I have a list of contacts and they are classified in a number of groups.
These groups are stored in a table.
Then I have users in my application and for each users I want to specify their rights: no/read/write.
In order to achieve this I have created a userspermission table as such :
<?php
namespace Curuba\contactsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use APY\DataGridBundle\Grid\Mapping as GRID;
/**
* userspermissions
*
* #ORM\Table()
* #ORM\Entity(repositoryClass="Curuba\contactsBundle\Entity\userspermissionsRepository")
*/
class userspermissions
{
/**
* #var integer
*
* #ORM\Column(name="id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #var string
*
* #ORM\Column(name="permission", type="string", length=10)
*
* #GRID\Column(title="Permission")
*
*/
private $permission;
/**
* #ORM\ManyToOne(targetEntity="groupes", inversedBy="permissions")
* #ORM\JoinColumn(nullable=false)
*
* #GRID\Column(title="Groupes")
*/
private $groupe;
/**
* #ORM\ManyToOne(targetEntity="users", inversedBy="permissions")
* #ORM\JoinColumn(nullable=false)
*
* #GRID\Column(title="Permission")
*/
private $user;
Now in my user form, I would need to show a table with all available groups and a drop-down list in front of them.
But I dont know how to achieve that without a collection and then asking the user to add a group permission, select a group and the according permission.
Thanks in advance.
You can use an ManyToOne relation.
For example with an User and Group
<?php
use Doctrine\ORM\Mapping as ORM;
/**
* #ORM\Entity
* #ORM\Table(name="groups")
*/
class Group
{
const CLASS_NAME = __CLASS__;
/**
* #var integer
*
* #ORM\Id()
* #ORM\GeneratedValue(strategy="AUTO")
* #ORM\Column(name="id",type="integer")
*/
private $id;
/**
* #var string
*
* #ORM\Column(name="label",type="string",length=255)
*/
private $label;
/**
* #param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* #return int
*/
public function getId()
{
return $this->id;
}
/**
* #param string $label
*/
public function setLabel($label)
{
$this->label = $label;
}
/**
* #return string
*/
public function getLabel()
{
return $this->label;
}
/**
* #return string
*/
public function __toString()
{
return $this->getLabel();
}
}
and the User entity
<?php
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
*
* #ORM\Entity
* #ORM\Table(name="user")
*/
class User
{
const CLASS_NAME = __CLASS__;
/**
* #var integer
*
* #ORM\Id()
* #ORM\GeneratedValue(strategy="AUTO")
* #ORM\Column(name="id",type="integer")
*/
private $id;
/**
* #var string
*
* #ORM\Column(type="string", name="label", length=255)
*/
private $label;
/**
* #ORM\ManyToMany(targetEntity="Group")
* #ORM\JoinTable(name="user_group",
* joinColumns={#ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={#ORM\JoinColumn(name="group_id", referencedColumnName="id")}
* )
**/
private $groups;
public function __construct()
{
$this->groups = new ArrayCollection();
}
/**
* #param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* #return int
*/
public function getId()
{
return $this->id;
}
/**
* #param string $label
*/
public function setLabel($label)
{
$this->label = $label;
}
/**
* #return string
*/
public function getLabel()
{
return $this->label;
}
/**
* #param Group $group
*
* #return bool
*/
public function hasGroup(Group $group)
{
return $this->groups->contains($group);
}
/**
* #param Group $group
*
* #return $this
*/
public function addGroup(Group $group)
{
if (false === $this->hasGroup($group)) {
$this->groups->add($group);
}
return $this;
}
/**
* #return \Doctrine\Common\Collections\ArrayCollection
*/
public function getGroups()
{
return $this->groups;
}
/**
* #return string
*/
public function __toString()
{
return $this->getLabel();
}
}
and finally create an form type like this :
class UserType extends AbstractType
{
const NAME = 'userType';
/**
* #param FormBuilderInterface $builder
* #param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('label', 'text');
$builder->add('groups', 'entity', array(
'class' => Group::CLASS_NAME,
'multiple' => true,
'expanded' => true,
));
}
/**
* #param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => User::CLASS_NAME,
));
}
/**
* Returns the name of this type.
*
* #return string The name of this type
*/
public function getName()
{
return self::NAME;
}
}
I have found how to do this. This is in fact very simple and I was probably expecting something more complex...
I have added a function in my controller (could be in my entity...) and I cal this function when I create a new user entity or when I edit one (in case a groupe has been added in the mean time.
Here is the code:
private function autocompleteForm(users $user) {
$em = $this->getDoctrine()->getManager();
$groupes = $em->getRepository('contactsBundle:groupes')->findAll();
if ($user) {
foreach ($groupes as $groupe) {
$permission = $em->getRepository('contactsBundle:userspermissions')->findOneBy(array('groupe' => $groupe, 'user' => $user));
if(!$permission) {
$permission = new userspermissions();
$permission->setGroupe($groupe);
$user->addPermission($permission);
}
}
}
return $user;
}
I am happy to explain more if someone needs...
I'm trying to use Doctrine 2 ORM for one of my Zend2 applications. I did the setup within the application using Doctrine modules with the help of composer.
I'm able to persist the data to the database, but when i make a find() call on the object manager it is giving me a Mapping Exception, with the following message.
Doctrine\Common\Persistence\Mapping\MappingException
File:
/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php:96
Message:
Class 'User' does not exist
Below are the Doctrine settings added under the Application module config file
'driver' => array(
'application_entities' => array(
'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/Application/Entity')
),
'orm_default' => array(
'drivers' => array(
'Application\Entity' => 'application_entities'
)
)
)
),
This is the User Entity created under Application\src\Entity folder
<?php
namespace Application\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* #ORM\Entity
*/
class User {
/**
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="NONE")
* #var int
*/
protected $user_id;
/**
* #ORM\Column(type="integer")
* #var int
*/
protected $network_id;
/**
* #ORM\Column(type="string", length=64)
* #var string
*/
protected $network_name;
/**
* #ORM\Column(type="string", length=64)
* #var string
*/
protected $job_title;
/**
* #ORM\Column(type="string", length=64)
* #var string
*/
protected $location;
/**
* #ORM\Column(type="string", length=64)
* #var string
*/
protected $first_name;
/**
* #ORM\Column(type="string", length=64)
* #var string
*/
protected $last_name;
/**
* #ORM\Column(type="string", length=255)
* #var string
*/
protected $url;
/**
* #ORM\Column(type="string", length=255)
* #var string
*/
protected $img_url;
/**
* #ORM\Column(type="string", length=255)
* #var string
*/
protected $department;
/**
* #ORM\Column(type="string", length=255)
* #var string
*/
protected $email_address;
/**
* #ORM\Column(type="boolean")
* #var string
*/
protected $verified;
/**
* #return the int
*/
public function getUserId() {
return $this->user_id;
}
/**
* #param int $user_id
*/
public function setUserId($user_id) {
$this->user_id = $user_id;
return $this;
}
/**
* #return the int
*/
public function getNetworkId() {
return $this->network_id;
}
/**
* #param int $network_id
*/
public function setNetworkId($network_id) {
$this->network_id = $network_id;
return $this;
}
/**
* #return the string
*/
public function getNetworkName() {
return $this->network_name;
}
/**
* #param string $network_name
*/
public function setNetworkName($network_name) {
$this->network_name = $network_name;
return $this;
}
/**
* #return the string
*/
public function getJobTitle() {
return $this->job_title;
}
/**
* #param string $job_title
*/
public function setJobTitle($job_title) {
$this->job_title = $job_title;
return $this;
}
/**
* #return the string
*/
public function getLocation() {
return $this->location;
}
/**
* #param string $location
*/
public function setLocation($location) {
$this->location = $location;
return $this;
}
/**
* #return the string
*/
public function getFirstName() {
return $this->first_name;
}
/**
* #param string $first_name
*/
public function setFirstName($first_name) {
$this->first_name = $first_name;
return $this;
}
/**
* #return the string
*/
public function getLastName() {
return $this->last_name;
}
/**
* #param string $last_name
*/
public function setLastName($last_name) {
$this->last_name = $last_name;
return $this;
}
/**
* #return the string
*/
public function getUrl() {
return $this->url;
}
/**
* #param string $url
*/
public function setUrl($url) {
$this->url = $url;
return $this;
}
/**
* #return the string
*/
public function getImgUrl() {
return $this->img_url;
}
/**
* #param string $img_url
*/
public function setImgUrl($img_url) {
$this->img_url = $img_url;
return $this;
}
/**
* #return the string
*/
public function getDepartment() {
return $this->department;
}
/**
* #param string $department
*/
public function setDepartment($department) {
$this->department = $department;
return $this;
}
/**
* #return the string
*/
public function getEmailAddress() {
return $this->email_address;
}
/**
* #param string $email_address
*/
public function setEmailAddress($email_address) {
$this->email_address = $email_address;
return $this;
}
/**
* #return the boolean
*/
public function getVerified() {
return $this->verified;
}
/**
* #param boolean $verified
*/
public function setVerified($verfied) {
$this->verified = $verfied;
return $this;
}
}
Now, when I do persist operation on the above entity from Application module's IndexController, it is working fine. But when I do the find operation using the same object mapper in the same IndexController, it is giving the mapping exception.
Below is how I'm doing this:
$objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
$objectManager->persist($user);
$objectManager->flush();
$user = $objectManager->find('User', $uniqueID);
Can anyone help me with this issue??
Regards.
Your entity is not called User but Application\Entity\User. So replace this line:
$user = $objectManager->find('User', $uniqueID);
With this:
$user = $objectManager->find('Application\Entity\User', $uniqueID);
I have integrated zend with doctrine, and everything works but when I start to genereate entities using doctrine cli: doctrine orm:generate-entities
I get php Entities class without #ORM, #Entity in comments.
Example:
<?php
use Doctrine\ORM\Mapping as ORM;
/**
* Tag
*/
class Tag
{
/**
* #var string $tagName
*/
private $tagName;
/**
* #var \Doctrine\Common\Collections\ArrayCollection
*/
private $eventevent;
/**
* Constructor
*/
public function __construct()
{
$this->eventevent = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get tagName
*
* #return string
*/
public function getTagName()
{
return $this->tagName;
}
/**
* Add eventevent
*
* #param Event $eventevent
* #return Tag
*/
public function addEventevent(\Event $eventevent)
{
$this->eventevent[] = $eventevent;
return $this;
}
/**
* Remove eventevent
*
* #param Event $eventevent
*/
public function removeEventevent(\Event $eventevent)
{
$this->eventevent->removeElement($eventevent);
}
/**
* Get eventevent
*
* #return Doctrine\Common\Collections\Collection
*/
public function getEventevent()
{
return $this->eventevent;
}
}
Project with symfony 2 and mongoDB.
I'm following this tutorial: http://symfony.com/doc/current/cookbook/form/form_collections.html
But once I save the form I get this error:
Cannot create a DBRef, the document is not an object
Line of crash:
https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/DocumentManager.php#L691
Form code:
namespace Fonts\FontsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class FamilyType extends AbstractType
{
public function __construct($dm)
{
$this->dm = $dm;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', 'text', array('max_length' => 50, 'error_bubbling' => true));
$builder->add('fonts', 'collection', array(
'type' => new FontType($this->dm),
'allow_add' => true,
'by_reference' => false,
));
}
public function getName()
{
return 'Family';
}
}
Controller code:
namespace Fonts\FontsBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Fonts\FontsBundle\Document\Family;
use Fonts\FontsBundle\Document\Font;
use Fonts\FontsBundle\Form\Type\FamilyType;
class FamilyBackendController extends BaseController
{
public function newAction()
{
try {
$family = new Family();
$form = $this->createForm(new FamilyType($this->getMongoService()), $family);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
if ($form->isValid())
{
$this->persist($family);
$this->get('session')->setFlash('notice', 'Item successfully created.');
return ($request->request->get('save') === 'Save') ?
new RedirectResponse($this->generateUrl('backend_familys_list')) :
new RedirectResponse($this->generateUrl('backend_familys_new'));
}
}
return $this->render('FontsBundle:Backend:newFamily.html.twig', array(
'form' => $form->createView(),
));
} catch(\Exception $e) {
return new Response($e->getMessage());
}
}
}
Document:
<?php
namespace Fonts\FontsBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
use Fonts\FontsBundle\Service\SlugService;
/**
* #MongoDB\Document(repositoryClass="Fonts\FontsBundle\Repository\FamilyRepository")
*/
class Family
{
/**
* #MongoDB\Id
*/
protected $id;
/**
* #MongoDB\String
* #MongoDB\UniqueIndex(safe=true)
* #Assert\NotBlank(message="FamilyName value should not be blank.")
* #Assert\MinLength(limit=3,message="FamilyName must have at least {{ limit }} characters.")
* #Assert\MaxLength(limit=50,message="FamilyName must have maximum {{ limit }} characters.")
*/
protected $name;
/**
* #MongoDB\ReferenceMany(targetDocument="Font", simple=true)
* #Assert\NotBlank(message="Fonts should not be blank.")
*/
protected $fonts;
/**
* #MongoDB\String
* #MongoDB\UniqueIndex(safe=true)
*/
protected $slug;
/**
* #MongoDB\Int
*/
protected $createdAt;
public function __construct()
{
$this->fonts = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* #return id $id
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* #param string $name
* #return Family
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* #return string $name
*/
public function getName()
{
return $this->name;
}
/**
* Add fonts
*
* #param Fonts\FontsBundle\Document\Font $fonts
*/
public function addFonts(\Fonts\FontsBundle\Document\Font $fonts)
{
$this->fonts[] = $fonts;
}
/**
* Set fonts
*
* #param Doctrine\Common\Collections\Collection $fonts
*/
public function setFonts($fonts)
{
$this->fonts = $fonts;
}
/**
* Get fonts
*
* #return Doctrine\Common\Collections\Collection $fonts
*/
public function getFonts()
{
return $this->fonts;
}
/**
* Set slug
*
* #param string $slug
* #return Family
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* #return string $slug
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set createdAt
*
* #param int $createdAt
* #return Family
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* #return int $createdAt
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* #MongoDB\PrePersist
*/
public function prePersist()
{
$this->setCreatedAt(time());
$slugService = new SlugService();
$this->setSlug($slugService->slug($this->getName()));
}
/**
* #MongoDB\PreUpdate
*/
public function preUpdate()
{
$slugService = new SlugService();
$this->setSlug($slugService->slug($this->getName()));
}
}
The form crash when I try to persist the object in the controller action_
$this->persist($family);
I tried lot of options but no one with good results. If you have some idea, please reply.