This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Bug - Question - ies changes to y

Other symfony projects

Bug - Question - ies changes to y

by Dev » Thu Mar 06, 2014 12:32 pm

Hello everyone I tought I first ask you guys if this is a reall bug or where I can check all the current reportet bugs

I'am currently developing with the following:
[list=]
PHP 5.5.4 (cli) (built: Oct 3 2013 12:20:52)
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
Symfony version 2.3.5-DEV
Nginix, Ubuntu, Mysql
[/list]

anyway I came across the follwing bug:
I made my form and try to submitt it as usual, after that Symfony sould save my data but the following error shows up:

Error Message:
Neither the property "bookSeries" nor one of the methods "addBookSery()", "setBookSeries()", "__set()" or "__call()" exist and have public access in class "\Entity\Sections".


Entity - Section (which sould be saved)
Code: Select all
/**
 * Sections
 *
 * @ORM\Table(name="sections")
 * @ORM\Entity
 */
class Sections
{
    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="BookSeries", inversedBy="section")
     * @ORM\JoinTable(name="section_has_book_series",
     *   joinColumns={
     *     @ORM\JoinColumn(name="section_id", referencedColumnName="id")
     *   },
     *   inverseJoinColumns={
     *     @ORM\JoinColumn(name="book_series_id", referencedColumnName="id")
     *   }
     * )
     */
    private $bookSeries;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->bookSeries = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add bookSeries
     *
     * @param \MyBundle\Entity\BookSeries $bookSeries
     * @return Sections
     */
    public function addBookSerie(\MyBudndle\Entity\BookSeries $bookSeries)
    {
        $this->bookSeries[] = $bookSeries;
   
        return $this;
    }

    /**
     * Remove bookSeries
     *
     * @param \MyBundle\Entity\BookSeries $bookSeries
     */
    public function removeBookSerie(\MyBundle\Entity\BookSeries $bookSeries)
    {
        $this->bookSeries->removeElement($bookSeries);
    }

    /**
     * Get bookSeries
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getBookSeries()
    {
        return $this->bookSeries;
    }
}



My Controller looks like this
Code: Select all
    /**
     * Add a Section
     * Funktion: Edit a specific Section
     * @return type
     */
    public function addSectionsAction(Request $request){
        $em    = $this->getDoctrine()->getManager();
       
        $formType = new [color=#FF8000]EditSections[/color]();
        $form = $this->createForm($formType);
        $formView = array('form' => $form->createView());
        // on form submission
        if ($request->getMethod() == 'POST') {
            $form->bind($request);
            if ($form->isValid()) {
                $data = $form->getData();
                try{                   
                    $em->persist($data);
                    $em->flush();                   
                } catch (Exception $ex) {
                    echo $ex;
                }
            }   
            return $this->redirect($this->generateUrl('MYURL'));
        }
        return $this->render('template.html.twig', $formView);
    }   



My EditSections (the genemu_jqueryselect2_entity is a vendor for autocompletion and extendet functionality)
Code: Select all
        $builder->add('bookSeries', 'genemu_jqueryselect2_entity', array(
            'label' => 'Book series',
            'class' => 'MyBundle:BookSeries',
            'required' => false,
            'multiple' => true,
            'expanded' => false,
            'empty_value' => 'Please select an Book serie'
            ));



If I now change the bookSeries to something else
Code: Select all
 $builder->add('bookSeriesChanged', 'genemu_jqueryselect2_entity', array(

New Error
Neither the property "bookSeriesChanged" nor one of the methods "getBookSeriesChanged()", "isBookSeriesChanged()", "hasBookSeriesChanged()", "__get()" exist and have public access in class "MDPI\BooksBundle\Entity\Sections".



--> there is no typo now and if I change it in the entity everything works so I am looking for a solution I just wonder why Symfony is implementing typos ??

:D~:-D~:grin: So thx for reading and if you know if this is a bug or how and why it occures that would be really great
Dev
Junior Member
 
Posts: 1
Joined: Thu Mar 06, 2014 11:57 am