Skip to content
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

load node data before calling nodeFactory #120

Open
achtan opened this issue Feb 14, 2014 · 1 comment
Open

load node data before calling nodeFactory #120

achtan opened this issue Feb 14, 2014 · 1 comment

Comments

@achtan
Copy link

achtan commented Feb 14, 2014

its rly cool that i can set my own nodeFactory!
I want use different node class for different labels. For example if i have label Movie i want create MovieNode, for label Person i want PersonNode, etc.
But i cant decide what node i should create before the node data is actually loaded.
This situation is happening in $client->getNode()
on 332 is node created

$node = $this->makeNode();

and on 340 is data loaded
$result = $this->loadNode($node);

@flip111
Copy link
Contributor

flip111 commented Jul 9, 2015

The conveniant functions don't allow you to inspect the data before the node is constructed. I inspected the code and it seems it would need a lot of refactoring. Because now it works like this:

  1. the node is constructed
  2. the node is inserted into a command
  3. the data is fetched from the database (through some function calls in php)
  4. eventually the command is responsible for initiating the data loading into the node

The shortcut (untested) would be to:

  1. Get the raw data
  2. Construct your own node class by calling your factory directly
  3. Call the entity mapper to populare your node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants