Friday, May 24, 2013

Creating Entity / Table baru


Create fail spt dibawah :

<pre>
// src/Blogger/BlogBundle/Entity/Surah.php
namespace ASF\PembedaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
 * @ORM\Entity
 * @ORM\Table(name="j3_pembeda_surah")
 */
class Surah
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
    /**
     * @ORM\Column(type="string")
     */
    protected $nama_surah;
    /**
     * @ORM\Column(type="string")
     */
    protected $nama_surah2;
    /**
     * @ORM\Column(type="string", length=100)
     */
    protected $category;
    /**
     * @ORM\Column(type="text")
     */
    protected $pengenalan;

    /**
     * @ORM\Column(type="string", length=20)
     */
    protected $image;

    /**
     * @ORM\Column(type="text")
     */
    protected $tags;

    protected $comments;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $created;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $updated;
   
}
</pre>

run command utk generate getters & setters :

php app/console doctrine:generate:entities ASF

Create databases , klu belum ada lagi
 cek fail nih dulu nama database dia ::
      php app/console doctrine:generate:entities Blogger

php app/console doctrine:database:create


Create table , dari entity fail :

php app/console doctrine:schema:create


No comments:

Post a Comment