I’m following the symfoy documentation but still foggy on some of the variables / statements in the code and looking for some clarification.
I have the 2 fields from the database and the file entity/Category.php to access the database list it below.
Question:
In order for the script to work I had to rename cat_category to category otherwise it through out an error message but yet the script works with cat_index . In fact, after changing from cat_category to category i was able to save information and under cat_index it did add a value. why is that?
I do like the idea of have prefix in front of my table/fields to make it easier to read.
the 2 table fields
cat_index
cat_category
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="tbl_category")
*/
class Categories
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=50)
*/
protected $category;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set category
*
* @param string $category
* @return categories
*/
public function setCategory($category)
{
$this->category = $category;
return $this;
}
/**
* Get category
*
* @return string
*/
public function getCategory()
{
return $this->category;
}
}