This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Separate form and input filters #20
Open
bakura10
wants to merge
11
commits into
Bacon:master
Choose a base branch
from
bakura10:fieldsets
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
45a2365
Separate form and input filters
bakura10 f3997bc
Remove dead code
bakura10 ac765f7
Remove deprecate method
bakura10 116ae58
Fix conflicts
bakura10 9e640ff
Sync with latest master and various fixes
bakura10 f5d0c1e
Updated test
bakura10 7a89a09
Fix tests
bakura10 1e9831f
Remove useless code
bakura10 8228ddb
Corrected service identifier for RegistrationForm move to User path
152496b
Corrected service identifier for RegistrationForm move to User path
a0805a0
Merge pull request #3 from jguthery/patch-2
bakura10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* BaconUser | ||
* | ||
* @link http://github.com/Bacon/BaconUser For the canonical source repository | ||
* @copyright 2013 Ben Scholzen 'DASPRiD' | ||
* @license http://opensource.org/licenses/BSD-2-Clause Simplified BSD License | ||
*/ | ||
|
||
namespace BaconUser\Form\Factory; | ||
|
||
use BaconUser\Form\UserFieldset; | ||
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
/** | ||
* Service factory that instantiates {@see UserFieldset}. | ||
*/ | ||
class UserFieldsetFactory implements FactoryInterface | ||
{ | ||
/** | ||
* createService(): defined by FactoryInterface. | ||
* | ||
* @see FactoryInterface::createService() | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return UserFieldset | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$parentLocator = $serviceLocator->getServiceLocator(); | ||
$options = $parentLocator->get('BaconUser\Options\UserOptions'); | ||
$hydrator = $parentLocator->get('HydratorManager')->get('BaconUser\Hydrator\UserHydrator'); | ||
|
||
$fieldset = new UserFieldset($hydrator, $options); | ||
|
||
return $fieldset; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* BaconUser | ||
* | ||
* @link http://github.com/Bacon/BaconUser For the canonical source repository | ||
* @copyright 2013 Ben Scholzen 'DASPRiD' | ||
* @license http://opensource.org/licenses/BSD-2-Clause Simplified BSD License | ||
*/ | ||
|
||
namespace BaconUser\Form\User; | ||
|
||
use BaconUser\Options\UserOptionsInterface; | ||
use Zend\Form\Form; | ||
|
||
/** | ||
* Generic registration form. | ||
*/ | ||
class RegistrationForm extends Form | ||
{ | ||
public function init() | ||
{ | ||
$this->setName('registration-form'); | ||
|
||
$this->add(array( | ||
'type' => 'BaconUser\Form\UserFieldset', | ||
'name' => 'user', | ||
'options' => array( | ||
'use_as_base_fieldset' => true | ||
) | ||
)); | ||
|
||
$this->add(array( | ||
'type' => 'Csrf', | ||
'name' => 'csrf' | ||
)); | ||
|
||
$this->add(array( | ||
'type' => 'Submit', | ||
'name' => 'submit', | ||
'options' => array( | ||
'label' => 'Register', | ||
) | ||
)); | ||
|
||
// Add specific registration elements | ||
|
||
$userFieldset = $this->get('user'); | ||
$userFieldset->add(array( | ||
'type' => 'Password', | ||
'name' => 'passwordVerification', | ||
'options' => array( | ||
'label' => 'Verify password' | ||
), | ||
'attributes' => array( | ||
'required' => 'required' | ||
) | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this one happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly for hydrators, as most hydrators often do "set" . $key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, I don't like all of those naming confusions. Sometimes underscore_separated, sometimes camelCase... But the problem is complex and if we want something coherent we really should establish a standard for common components, so that each component by default can assume something about how data is named :/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We go with underscore_separated in all arrays so far, shouldn't be different here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be a problem for most hydrators that inflect the setter/getter based on the key. For instance DoctrineModule hydrator's assume that setter is "set" . ucfirst($key). So if we keep this underscore_separated people should define setFirst_Name method. I just went with the situation that will fit most situations without having to override each hydrator.