I’m using this tutorial as the basis for a Code Igniter / Doctrine based project.
http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-3-user-signup-form
Instead of using the code as-is for the models, my project is using a YAML schema file to generate the models
I’ve hit a snag, in that I’ve got no idea how to represent the following using YAML:
$this->hasMutator('password', '_encrypt_password');
(this is from the User model code, under ‘Adding Mutators’)
Specifically, I’m having trouble with the $this->hasMutator line
I’ve googled until blue, searched documentation for Doctrine, symfony (which I know uses Doctrine heavily) and even grep’d the codebase for references to mutators – I’ve come up empty
Is there a way to represent the line $this->hasMutator(‘password’, ‘_encrypt_password’); using Doctrine YAML?
(Just a note to clarify: we are talking about Doctrine 1.x here and not Doctrine 2.x)
No, there is no a way to define mutators directly in your YAML schema. Are you sure you must register the mutator there?
You could get around this limitation by creating you own doctrine behavior. Doctrine behaviors can be assigned to your models in the YAML schema. Read more here:
http://www.doctrine-project.org/projects/orm/1.2/docs/manual/behaviors/pl
In your case the behavior would look something like this:
And in your yaml schema: