Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7697473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:01:18+00:00 2026-05-31T22:01:18+00:00

I am using the CodeIgniter DataMapper ORM, but there is something that I don’t

  • 0

I am using the CodeIgniter DataMapper ORM, but there is something that I don’t quite understand.

In this example, http://datamapper.wanwizard.eu/pages/examples/login.html, you can see that there are some $validation rules defined on the User model class.

Inside the login function, you can also see that it calls $this->validate()->get(). When the validation function is run, it should check against all rules from $validation.

What I don’t understand is, for the login use case, only username and password need to be validated but you can see there are other validation rules unrelated to this use case in the example. Specifically, there is a confirm_password rule defined on $validation and this rule obviously is only for the update use case, rather than the login use case.

Since I don’t see any codes that bypass these unrelated rules in the example, how does the DataMapper ORM actually know these unrelated rules can be bypassed in the login function?

Many thanks to you all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:01:19+00:00Added an answer on May 31, 2026 at 10:01 pm

    Datamapper’s validation method ignores rules for fields not part of the object. So the confirm_password rule won’t trigged unless the object has a property by that field name.

    Data validation rules should be in the model, not in the controller, as it is the only entry point to your data, and it ensures all data going into the database is validation. It also answers to DRY, you don’t want to define validation rules in every controller that uses the model.

    Given this fact, it is simple to define the rules for extra fields that might be on your CRUD forms as well and keep it all in one place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking at using DataMapper ORM with CodeIgniter, but have a scenario where the
I need help constructing a CodeIgniter Datamapper ORM query that includes join fields. I
I am using CodeIgniter's form validation . Here is an example: $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
I'm using the DMZ DataMapper ORM for CodeIgniter. I'm sure it is possible to
I am using Codeigniter 2.0.3 with DataMapper ORM 1.6.0. Integration DataMapper in CI has
I am having trouble with a specific query, using Datamapper ORM for Codeigniter. My
I'm using CodeIgniter and I got a model that fetches let's say all recipes
I'm using CodeIgniter (because it's awesome) and I have something like: <?php echo anchor(/,
I'm using CodeIgniter with CodeIgniter sessions that are stored in a MySQL database. I
I'm using Codeigniter and Tank Auth for a e-commerce website. I'm finding that if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.