User.class.php 902 Bytes
<?php
    class User extends Model {
        // ===========
        // = Statics =
        // ===========
        protected static $table_name = 'USER';

        public static function create($post) {
            parent::exec('USER_CREATE', [':name' => $post['name'], ':email' => $post['email']]);
        }

        public static function getList() {
            $stm = parent::exec('USER_GET_LIST');
            return $stm->fetchAll();
        }

        public static function getWithId($id) {
            $stm = parent::exec('USER_GET_WITH_ID', [':id' => $id]);
            return $stm->fetchAll();
        }

        public static function update($put, $id) {
            parent::exec('USER_UPDATE', [':name' => $put->name, ':email' => $put->email, ':id' => $id]);
        }

        public static function delete($id) {
            parent::exec('USER_DELETE', [':id' => $id]);
        }
    }
?>