title: Import CSV file to database in yii?
body: <p>I want to important a .csv file to database table with the validations..</p>
  
  <p>I have a function <code>add user</code> on a add user form, It has validation on extension number, which is unique..</p>
  
  <p>I also have an option to add bulk users using .csv file. I can add users to it but how to add validations to it, when i try to upload .csv file with user details, it should show error that <code>extension is already used</code> but upload other extension numbers.</p>
  
  <p>for example if the .csv have 100 users, and 80 users are uploaded, but 20 users are not uploaded because their extension number already exists in database table, so i want these 20 to be exported in .csv file. and display error.</p>
  
  <p>My model is</p>
  
  <p>I have a company, each company has many users, each user has unique extension number. if extension number 100 is assigned to user 1 then it cannot be assigned to user 2.</p>
  
  <p>How can i achieve this? any suggestions, help with some code.? Thanks</p>