-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Roadmap to version 2 #87
Comments
I hope with these changes to also solve #1, other planned features will be added in the 1.x branch when possible 👍 |
Updated with some new idea's and notes. Proposed changes are much better now, and less 'change all the things'. |
Scratched the immutable values idea, it's to much complexity for little gain. |
New change: Remove model mapping completely, only Doctrine ORM uses this and implementation and its a bit complex to use and understand. I prefer explicit configuration of fields to |
TL;DR: Version 1.x becomes an LTS version and 2.0 will not be backward compatible, Support for Symfony 2 and PHP 5 is dropped, 1.x becomes an LTS version The main goal is to get rid of old architecture problems and embrace Because keeping compatibility while embracing a completely new API Rules:
To allow for enough development time, this release follows FieldSet
Input and values (DONE)
Simple (excluded) values don't require an object anymore, Alias/Label resolving (DONE)Remove the FieldAliasResolver and FieldLabelResolver, this is only And add the View and exported-normalized representation (DONE 🤘 )
Note: There is only one normalize-transformer and view-transformer allowed Method changes for ValuesBag (DONE)All specific methods will be removed, instead the class has only the following Which support all classes implementing the The simple (excluded) value methods will remain (as they have no interface). Improved error handling (DONE)Input is transformed (and validated using a validator implementation) In case of a transformation or validation failure the value is stored in an When the process was successful it returns a Using an exception makes strict return-type possible InvalidValue (DONE)The For example the path for an FilterQuery is While the array process provides SmartQuery could provide something as simple as a value position (eg. 1). Nested optimizers (feature) (REJECTED, maybe later)Add optimizers that operate on nested values, eg. a value
To Resolve and other stuff
Processor (DONE)Make processors stateless - use a
SearchPayload (immutable, serializable):
Api Platform support (separate package)Focused on Api Platform 2.0. Provide condition as array, only process when there is no cached
When there is an error an "error"-context result is returned Provide a rate limiter for Search operations, n new conditions |
Note to self: Remove group-id and level-count from exceptions, always communicate the full path to processing methods. Don't keep this as properties as there is much risk of getting this wrong. Edit. Do keep the current level as property, as this doesn't affect other flows. |
New idea for the Error handling. Throw only This solves a number of problems:
DONE. |
So far so good, Doctrine ORM is not as easy as I'd hoped, but I will get it done before the deadline (I hope). |
Doctrine ORM integration is as good as done, the Symfony integration bundle needs to be updated. As I have not had any big changes in the way Doctrine DBAL/ORM is used I'm thinking about moving these back the main bundle, and enabling them automatically when the dependencies are met. |
🎉 We have an v2.0.0-ALPHA1 release for the project! |
TL;DR: Version 1.x will become an LTS version and 2.0 will not be backward compatible, requires at least PHP 7 and Symfony 3.
For RollerworksSearch 2 I propose the following (rigorous) changes:
Support for Symfony 2 and PHP 5 is dropped, 1.x becomes an LTS version
with support until Nov 2018 (bug only fixes).
The main goal is to get rid of old architecture problems and embrace
good quality code and new features. All deprecations are removed.
DX and performance is a pre!
The new API is whenever possible introduced
(adding new methods to an interface is allowed).
2.0 will introduce a number of BC breaking changes that are
not possible with a BC layer. Mainly the usage of PHP 7 scalar type hints,
and strict return-types.
Rules:
for the 1.x branch;
to upgrade, it's not a smooth transition as 2.0 has other breaking changes;
First stage:
Second stage:
testing
Final stage (approximately 3 months after last beta release)
FieldSet
The FieldSet is immutable and cannot be changed after creation.
Use a FieldSetBuilder to keep the building process open.
FieldSet configuration in app-config is removed in favor of a FieldSet registry
with tags; The FieldSet name is removed, and for view it's replaced with a 'blockPrefix'.
A new view class is introduced: FieldSetView which holds all the SearchField
view classes. The client-side will need to handle the form-widget rendering.
Input and values
The
ValuesGroup
,ValuesBag
andInvalidValue
are moved to theValue
namespace and made immutable.
Calling a mutator method returns a new objectwith the changes applied. Existing objects remain unchanged.
As a small bonus it will be possible to pass multiple values in a singlecall, to prevent to much object creation.
And it will be possible to add custom value objects. Each value object needs to
implement the new
Rollerworks\Component\Search\Value\ValueHolder
interface.The
ValueHolder
extends the SPLSerializable
interface.Simple (excluded) values don't require an object anymore,
reduces memory usage (significantly)!
Alias/Label resolving
Deprecate the FieldAliasResolver with no alternative, this is only
used by the FilterQuery processor. Make the FilterQuery use the field label,
to build an internal alias resolver.
Deprecate FieldLabelResolverInterface in favor of a Symfony translator
extension for auto-configuring a label (run the field-name to a translator).
And add the
translation_domain
option for translation domain (default is search).Option is always present, but requires a processor to be effective.
View and exported-normalized representation
A
ValueHolder
does not contains a view representation, use thefield type view-transformer to get the human readable format.
If the value needs to be unlocalized (normalized) use the field type
normalizer-transformer. This is a new feature that FINALLY adds support
for REST API end-points!.
Note: There is only one normalizer-transformer and view-transformer allowed
per field, use a chain transformer if multiple are needed.
Method changes for ValuesBag
All specific methods will be removed, instead the class has only the following
methods for values: get, has, remove, add. Which support all classes implementing
the
ValueHolder
interface.The simple (excluded) value methods will remain (as they have no interface).
Getting a value happens by using the FQCN, so there is no risk of receiving
the wrong object 👍
Improved error handling
Input is transformed (and validated using a validator implementation)
by the input processor.
In case of a transformation or validation failure the value is stored in an
InvalidValue
object.At the end of the process, an
InvalidSearchConditionException
is thrownwith the origin input and a list of all the invalid values (
InvalidValue[]
).When the process was successful it returns a
SearchCondition
with transformed values.Using an exception makes strict return-type possible
and ensures failure don't go unnoticed.
InvalidValue
The
InvalidValue
class holds the same information as the current implementation,but the path value is highly dependent on processors format.
For example the path for an FilterQuery is
groups[0].fields['name']['value-position']
as there is no structure (only values at a specific position).
While the array process provides
groups[0].fields['field-name']['ranges'][0]
with a complete structure path.
SmartQuery could provide something as simple as a value position (eg. 1).
Nested optimizers (feature)
Add optimizers that operate on nested values, eg. a value
that is already present at a lower group level or a range
that in a deeper level that overlaps with a lower level range.
To Resolve and other stuff
[Input|Exporter]Factory
in favor of[Input|Exporter]ProcessorLoader
;for each framework separate)
SearchConditionInterface
, and use the class onlyFieldConfigInterface::getModelRef{Class|Property}()
{set|get}ViewTransformer()
(deprecate other transformer methods){set|get}ModelTransformer()
FieldConfigInterface::getDataLocked()
toFieldConfigInterface::isLocked()
Processor
Make processors stateless - use a
SearchPayload
object to store information;rollerworks/search-request-processor
SearchProcessor::processRequest(ServerRequest $request, ProcessorConfig $config, 'export-format'): SearchPayload
;SearchPayload (immutable, serializable):
Api Platform support (separate package)
Focused on Api Platform 2.0.
Provide condition as array, only process when there is no cached
result available. Caching is handled by persistence (short-lived).
The condition is always optimized and stored by the original input-hash.
When there is an error an "error"-context result is returned
with the related HTTP status-code.
Provide a rate limiter for Search operations, n new conditions
per time-frame by IP/Auth token.
The text was updated successfully, but these errors were encountered: