Example #1
0
 public function setUp()
 {
     require_once __DIR__ . '/../fixtures/Entity/User.php';
     require_once __DIR__ . '/../fixtures/EntityManager/UserEntityManager.php';
     Connection::setPath(__DIR__ . '/../fixtures/storage/');
     foreach (['users', 'books'] as $table) {
         $memory = Memory::make($table);
         $ref = new \ReflectionMethod($memory, 'reset');
         $ref->setAccessible(true);
         $ref->invoke($memory);
     }
 }
 /**
  * Delete Entity.
  * argument is null => Delete all.
  * argument is BaseEntity => Delete correspond entity.
  * argument is array (e.g. ['id' => 1]) => Delete correspond entity.
  * @param array|BaseEntity|null $target
  * @return bool
  */
 public static function delete($target = null)
 {
     $static = static::make();
     $storage = Memory::make($static->table);
     return (new DeleteQuery(static::class, $storage))->execute($target);
 }