title: Doctrine - delete data from table
body: <p>I have a class, let's say CoreDoctrine.php, and a function inside it that will be used to delete a record from a table, here's the code</p>
  
  <pre><code>public function delete($entityManager, $objek){
          $entityManager-&gt;remove($objek);
          $entityManager-&gt;flush();
          $entityManager-&gt;clear();
          echo "\n\n Data berhasil dihapus \n\n";
  
      }
  </code></pre>
  
  <p>where the $objek is the entity that i want to erase, and $entityManager parameter is the object of Doctrine's EntityManager that is returned from a function</p>
  
  <p>and then i run this code in the index.php like this</p>
  
  <pre><code>$doctrine = new CoreDoctrine();
  $em = $doctrine-&gt;instantiateEntities();  //this function returns the EntityManager object
  
  $doctrine-&gt;delete($em, $luki);  //where $luki is the entity object
  </code></pre>
  
  <p>when i execute the code, no error showed, but the data was not deleted from the database....
  am i missing something??</p>
  
  <p>update : here is the insinstantiateEntities() function :)</p>
  
  <pre><code>public function instantiateEntities(){
          $paths = array(__DIR__."/src");
          $isDevMode = false;
  
          // the connection configuration
          $dbParams = array(
              'host' =&gt; '127.0.0.1',
              'driver'   =&gt; 'pdo_mysql',
              'user'     =&gt; 'root',
              'password' =&gt; '',
              'dbname'   =&gt; 'apbo2',
          );
  
          $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
          $entityManager = EntityManager::create($dbParams, $config);
  
          return $entityManager;
      }
  </code></pre>