You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be extremely helpful for building a shared factory passed between an objection-using client and a non-objection using client. The database one would have certain associations or transient params relating to the relational properties defined by its objection model and used within create hooks that tell the database how to save the built object.
For example, say you have a rectangle factory and a canvasFactory that contains rectangles. This factory takes max and min values for its boundaries.
Now, lets say that a rectangle has a canvasId that references its parent canvas. It must have a parent canvas. However, some things that utilize this rectangle don't have database access to save these values for the test runner. For those, we extend the factory with a nice .withFakeDatabaseValues() hook that fills in those values, and we're good to go.
However, in database land, we have an issue. We want to extend the factory like this to allow us to create rectangles with their dependency trees in tact without having to create every member of the dependency tree explicitly beforehand. So, we want something like this:
Our canvas has transient params for a maximum dimension size and for a minimum dimension size just like the rect does. The minimum size is determined by the rect, since it has to contain the rect, but we don't want it always wrapping exactly at the edge of the rect. So the maximum is based on the original maximum fed to the rect.
Currently, there's no way to get that transientParam outside of the original define() call for rectangle factory, making this database code have to be dependency injected into a factory generator function that ends up being really weird and ugly. I personally think that the generatorOptions that are given to define should just be passed to the extensions.
This would be extremely helpful for building a shared factory passed between an objection-using client and a non-objection using client. The database one would have certain associations or transient params relating to the relational properties defined by its objection model and used within create hooks that tell the database how to save the built object.
For example, say you have a rectangle factory and a canvasFactory that contains rectangles. This factory takes max and min values for its boundaries.
Now, lets say that a rectangle has a canvasId that references its parent canvas. It must have a parent canvas. However, some things that utilize this rectangle don't have database access to save these values for the test runner. For those, we extend the factory with a nice .withFakeDatabaseValues() hook that fills in those values, and we're good to go.
However, in database land, we have an issue. We want to extend the factory like this to allow us to create rectangles with their dependency trees in tact without having to create every member of the dependency tree explicitly beforehand. So, we want something like this:
Our canvas has transient params for a maximum dimension size and for a minimum dimension size just like the rect does. The minimum size is determined by the rect, since it has to contain the rect, but we don't want it always wrapping exactly at the edge of the rect. So the maximum is based on the original maximum fed to the rect.
Currently, there's no way to get that transientParam outside of the original define() call for rectangle factory, making this database code have to be dependency injected into a factory generator function that ends up being really weird and ugly. I personally think that the generatorOptions that are given to define should just be passed to the extensions.
The text was updated successfully, but these errors were encountered: