Repository functions php