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
Automatic tree structure generation from passed array #34
Comments
Direct ancestor? If I understand you right, then you might want take a look at the On the other hand, if you want to create a tree from an array, something like @kapooostin suggested, then it's a different story. :) Your comments appreciated. |
I know about "appendChild()", but what I would need would be something like "appendAncestor()" (or appendThisToNode()) But then again you would need to make another query manually to set everything right. And I definitely would like to see this to be automatic like it is in my package right now. I think this should be as comfortable as possible. Hence I provided code as to how I did it ;) |
Oh, I understand your idea for now! |
@franzose Great. |
@thedancingbard, your conversation is good ) and the English is not ‘mine’ too :) it was misunderstanding of the conception. |
@franzose: So do you consider to implement this feature? I don't know how to implement this automatism without a "parent_id"-column in the "node/entity"-table. |
@thedancingbard, now i'm trying to fix other things, but this is interesting and useful too. And I will implement it someday. I think it can be implemented by playing with the closure table somehow, not the entity table. |
In a different approach, following @kapooostin suggestion i worked on this https://gist.github.com/vjandrea/6825675 |
@vjandrea, great, great, great! and i'm struggling with that fucking position column... |
@vjandrea, I think the method could be called |
@franzose, i agree for the name of the method. Regarding the issues with the position column, following the documentation, should be declared unsigned not null, so that's why we get exceptions when we try to set negative values. |
@vjandrea, update your package, I have finally fixed all known (for me) bugs with position... |
Just a little update, i started working on this branch: https://github.com/vjandrea/ClosureTable/tree/feature_34 to enable these methods:
and two other methods that i will use for testing import/export of different structures
As soon as i get rid of the errors in phpunit i'll go on with the development of these functions. |
Where you would like to put the |
As for JSON and Array, we should discuss them at #55. |
@vjandrea along the way I ponder about versioning. We have five versions already, but they are all buggy. |
@franzose, for the names it's fine, so if i understood we shall have: |
|
What do you think about milestone? I haven't used the feature yet. Would it be useful? |
I have seen milestones used in larger projects because you they allow to fix deadlines and priorities for bug fixing, but i think that in this project it would be overkill at the moment. Anyway if you want to try it to see how it works, why not? |
@vjandrea, as for reducing of the tests errors, there's nothing special. In |
@vjandrea any news? |
I'm working on it, but i have a hard time debugging because xdebug still doesn't want to work. |
@kapooostin, @thedancingbard, @vjandrea, I have some news. I have just finished the feature. Please, take a look at v3.0-dev. |
Okay, as you asked me to further explain my needs and also suggested to @kapooostin to create a new issue, I'll do this now. (here is the source: #26)
So, when I create a new node/entity I wanna specify the direct parent and the package should create all the corresponding closure-table (or tree)-entries completely automatically.
That for, I had that solution:
My entities or "nodes"-table had a "parent_id"-column.
Any my corresponding model had this boot()-method:
And this is the "createTreeEntry()"-method:
So, whenever I created a new node, I specified it's immediate parent (or null if it was a root) and then all the corresponding entries where created completely automatically.
like this:
That´s something I really find convenient and need, but I haven't yet figured out on how I would implement this into "ClosureTable 2" since you took a different approach on a few areas.
Would be great if we could find a way to implement this automatic approach.
Kindest regards,
The Dancing Bard
The text was updated successfully, but these errors were encountered: