We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24629
    • 370 Posts
    Hi,
    I've created custom tables with Bob's guides (https://bobsguides.com/custom-db-tables.html) and that works fine. my class is called 'Vote'

    Now i want to remove/delete the whole collection (votes) in that custom table using
    $modx->removeCollection( 'vote', array() );

    But that does not seem to work. in the error log i see
    Could not get table name for class: vote

    and
     xPDO->removeCollection - Error deleting vote instances using query DELETE FROM  


    I did do the addpackage on top of my script and that works fine
    $modx->addPackage( 'vote', $path . 'model/', 'lhm_' );


    anyone know what i'm doing wrong? or is removeCollection not meant for custom classes?

    Tnx
    RDG

    This question has been answered by rdaneeel. See the first response.

    • discuss.answer
      • 24629
      • 370 Posts
      Never mind,
      i figured it out
      instead of
      $modx->removeCollection( 'vote', array() );
      i need to use
      $modx->removeCollection( 'Vote', array() );

      the Capital V for the class name did the trick
      RDG