Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
CRUD generation
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
biel325  
View profile  
 More options Jul 11 2011, 1:32 pm
From: biel325 <biel...@gmail.com>
Date: Mon, 11 Jul 2011 10:32:57 -0700 (PDT)
Local: Mon, Jul 11 2011 1:32 pm
Subject: CRUD generation
Hi people.
I've used Symfony 2 crud generation and it's awesome! But on Creating
a new entry of a relationship ManytoOne I'm receiving an exception:
"Catchable Fatal Error: Object of class Acme\BlogBundle\Entity
\Paciente could not be converted to string in C:\Apache2\htdocs\Symfony
\vendor\symfony\src\Symfony\Bridge\Doctrine\Form\ChoiceList
\EntityChoiceList.php line 172"

inside the model the refered attribute is:
    /**
     * @var Paciente
     *
     * @ORM\ManyToOne(targetEntity="Paciente")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="consultapaciente",
referencedColumnName="id")
     * })
     */
    private $consultapaciente;

The form class generated by CRUD is like that:

public function buildForm(FormBuilder $builder, array $options)
    {
        $builder
            ->add('quantidade')
            ->add('receitapaciente')
            ->add('receitamedico')
            ->add('receitamed')
        ;
    }

How you people solved this? How are you dealing with the relationships
in forms


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rui Silva  
View profile  
 More options Jul 11 2011, 2:33 pm
From: Rui Silva <rui.pe...@gmail.com>
Date: Mon, 11 Jul 2011 11:33:16 -0700 (PDT)
Local: Mon, Jul 11 2011 2:33 pm
Subject: Re: CRUD generation

Looks like you need a __toString method on "consultapaciente". But, you
should post the kind of question on dedicated symfony2 group and not on core
development group.

Cheers,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Treml  
View profile  
 More options Jul 12 2011, 3:04 am
From: Martin Treml <treml.mar...@gmail.com>
Date: Tue, 12 Jul 2011 00:04:09 -0700 (PDT)
Local: Tues, Jul 12 2011 3:04 am
Subject: Re: CRUD generation
Add to your Entity\Paciente Class the method

public function __toString()
{
   return $this->name; (or something)

}

Or

Add the property option to your builder

->add('receitapaciente', array('property' => 'name' ))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
biel325  
View profile  
 More options Jul 13 2011, 6:11 pm
From: biel325 <biel...@gmail.com>
Date: Wed, 13 Jul 2011 15:11:44 -0700 (PDT)
Local: Wed, Jul 13 2011 6:11 pm
Subject: Re: CRUD generation
function __toString() worked very well. Thank you guys. I'm new on
Symfony groups and I didn't know the diference between the groups.
Sorry for any inconvenience.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »