Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8926893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:05:45+00:00 2026-06-15T08:05:45+00:00

i have two entities template and div their code is as follows: (i generated

  • 0

i have two entities template and div their code is as follows: (i generated it automatically via console)

    <?php

namespace Tun\PublicBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Tun\PublicBundle\Entity\Template
 *
 * @ORM\Table(name="template")
 * @ORM\Entity
 */
class Template
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=true)
     */
    private $name;

    /**
     * @var integer $nbreDiv
     *
     * @ORM\Column(name="nbre_div", type="integer", nullable=false)
     */
    private $nbreDiv;



    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set nbreDiv
     *
     * @param integer $nbreDiv
     */
    public function setNbreDiv($nbreDiv)
    {
        $this->nbreDiv = $nbreDiv;
    }

    /**
     * Get nbreDiv
     *
     * @return integer 
     */
    public function getNbreDiv()
    {
        return $this->nbreDiv;
    }
}

div:

<?php

namespace Tun\PublicBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Tun\PublicBundle\Entity\Div
 *
 * @ORM\Table(name="div")
 * @ORM\Entity
 */
class Div
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var integer $hauteur
     *
     * @ORM\Column(name="hauteur", type="integer", nullable=false)
     */
    private $hauteur;

    /**
     * @var integer $largeur
     *
     * @ORM\Column(name="largeur", type="integer", nullable=false)
     */
    private $largeur;

    /**
     * @var integer $ind
     *
     * @ORM\Column(name="ind", type="integer", nullable=true)
     */
    private $ind;


    /**
     * @var string $emplacement
     *
     * @ORM\Column(name="emplacement", type="string", length=255, nullable=false)
     */
    private $emplacement;

    /**
     * @var Template
     *
     * @ORM\ManyToOne(targetEntity="Template")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="template", referencedColumnName="id")
     * })
     */
    private $template;






    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set hauteur
     *
     * @param integer $hauteur
     */
    public function setHauteur($hauteur)
    {
        $this->hauteur = $hauteur;
    }

    /**
     * Get hauteur
     *
     * @return integer 
     */
    public function getHauteur()
    {
        return $this->hauteur;
    }

    /**
     * Set largeur
     *
     * @param integer $largeur
     */
    public function setLargeur($largeur)
    {
        $this->largeur = $largeur;
    }

    /**
     * Get ind
     *
     * @return integer 
     */
    public function getInd()
    {
        return $this->ind;
    }


    /**
     * Set ind
     *
     * @param integer $ind
     */
    public function setInd($ind)
    {
        $this->ind = $ind;
    }

    /**
     * Get largeur
     *
     * @return integer 
     */
    public function getLargeur()
    {
        return $this->largeur;
    }


    /**
     * Set emplacement
     *
     * @param string $emplacement
     */
    public function setEmplacement($emplacement)
    {
        $this->emplacement = $emplacement;
    }

    /**
     * Get emplacement
     *
     * @return string 
     */
    public function getEmplacement()
    {
        return $this->emplacement;
    }

    /**
     * Set template
     *
     * @param Tun\PublicBundle\Entity\Template $template
     */
    public function setTemplate(\Tun\PublicBundle\Entity\Template $template)
    {
        $this->template = $template;
    }

    /**
     * Get template
     *
     * @return Tun\PublicBundle\Entity\Template 
     */
    public function getTemplate()
    {
        return $this->template;
    }
}

Now here is the problem, i wish to create a template then a div, so i proceeded this way:

$template= new Template();
$template->setName($name);
$template->setNbreDiv($nbre_div);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($template);
$em->flush();

$d=new Div();
$d->setHauteur(100);
$d->setLargeur(100);
$d->setEmplacement("Gauche");
$d->setInd(1);
$d->setTemplate($template);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($d);
$em->flush();

And i get the following error :

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'div (hauteur, largeur, ind, emplacement, template) VALUES (100, 100, 1, 'Gauche'' at line 1

Hope i put everything, thanks for help in advance. I spent the whole day trying all the combination that come to my mind …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:05:47+00:00Added an answer on June 15, 2026 at 8:05 am

    DIV is a reserved keyword in MySQL. It is an operator, and is used for integer division. Example:

    mysql> SELECT 35 DIV 7;
    +----------+
    | 35 DIV 7 |
    +----------+
    |        5 |
    +----------+
    1 row in set (0.02 sec)
    

    My suggestion would be to rename this entity.

    Reference: MySQL Arithmetic Operators

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two entities say Customer and Order which exist on their own and
I have two entities in coredata: Voice described like: NSString *code NSString *description and
I have two entities: Recipe and Ingredient. Entites: public class Ingredient { public int
I have two entities A and B. public class A{ @Id @GeneratedValue private Integer
I have two entities Visita and Cliente that implements respectively two interfaces IVisita and
I have two entities like this: public class Service { public virtual int ServiceId
A have two entities. For example timing settings and orders. @Entity public class TimingSettings{
I have two entities: public class Parent() { public ICollection<Child> Children { get; set;
I have two entities: Patient and Job. Patient has a to-many relationship to Job
i have two Entities, Parent and Child, that are linked through a bidirectional one-to-many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.