Creating a new Taxonomy Field

148 views
Skip to first unread message

Prathmesh

unread,
Jan 10, 2013, 11:06:34 AM1/10/13
to qubi...@googlegroups.com
I am trying to create a new taxonomy field for the custom plugin we are developing on top of the DC Template. I did come across related forum posts :

And I did try some of the things mentioned in the post. But I was unsuccessful in creating a new Taxonomy and am stuck because of it in my custom plugin development and hoping someone can help me to resolve this. 
Jesus thus mention that its better to make changes to the Db using ORM - Propel. I am new to Propel and was not sure to modify which file to add the lines  , mentioned by Jesus :

$taxonomy = new QubitTaxonomy;
$taxonomy->parentId = QubitTaxonomy::ROOT_ID;
$taxonomy->name = "Victims";
$taxonomy->save(); // This creates the record into the database!


I also tried making the changes in the files QubitTaxonomy.php , taxonomyTerms.ymlQubitMigrate110.class.php as suggested by David but wasnt succesfull. 

Is there any wiki page or other documentation where the steps to add new Taxonomies to Qubit are mentioned sequentially , and also which files to modify ?

Any help is appreciated , Thanks a lot !

David Juhasz

unread,
Jan 16, 2013, 5:47:32 PM1/16/13
to qubit-dev
Hi Prathmesh,

Please post the code changes you have made so we can analyze it.  If you are modifying multiple files the easiest way to show us your modified code is probably to fork the https://github.com/artefactual/atom project on github, and send us the link for you fork.

Regards,
David


--
You received this message because you are subscribed to the Google Groups "Qubit Toolkit Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/qubit-dev/-/dDbGVITAKScJ.
To post to this group, send email to qubi...@googlegroups.com.
To unsubscribe from this group, send email to qubit-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/qubit-dev?hl=en.



--
David Juhasz
Director, Technical Services

Artefactual Systems Inc.
www.artefactual.com

David Juhasz

unread,
Jan 16, 2013, 5:51:46 PM1/16/13
to qubit-dev
Hi Prathmesh,

One other thing, please make sure the fork the "1.x" branch of AtoM:
https://github.com/artefactual/atom/tree/1.x

The "master" branch is for the 2.0 version of AtoM and it is not stable.

Regards,
David

Prathmesh

unread,
Jan 20, 2013, 4:42:24 PM1/20/13
to qubi...@googlegroups.com
Hi David,

  I didn't pull the development copy of Atom I am working on from gitHub and its not linked to any GitHub Repo, so I wont be able to fork Or share my code through GitHub. Is there any easy way I can share the few edited files I have for you to analyze.

And back to my original question, is there any wiki page or other documentation where the steps to add new Taxonomies to Qubit are mentioned sequentially. OR can you let me know here which files to modify & in what way in order for me to achieve this.

Thanks a lot for your help !
Prathmesh

Jesús García Crespo

unread,
Jan 20, 2013, 5:23:00 PM1/20/13
to qubi...@googlegroups.com
Hi there,

On Sun, Jan 20, 2013 at 1:42 PM, Prathmesh <prathmes...@gmail.com> wrote:
I didn't pull the development copy of Atom I am working on from gitHub and its not linked to any GitHub Repo, so I wont be able to fork Or share my code through GitHub. Is there any easy way I can share the few edited files I have for you to analyze.

We can review a patch or a git repository fork that we can have access to no matter its location. But I'm sorry to say that we can't just review your modified files since that would require a significant amount of time that we don't have.

You could use diff to generate a patch but our advice is always to use a source code management system. We like git, it takes a while to learn but you will never regret!
 
And back to my original question, is there any wiki page or other documentation where the steps to add new Taxonomies to Qubit are mentioned sequentially. OR can you let me know here which files to modify & in what way in order for me to achieve this.

You need to:
1) Add the new taxonomy and its terms into the fixtures (see data/fixtures)
2) Add a migration script (see lib/task/migrate) for users upgrading from older releases

If you take a look at the commit history you will see that many taxonomies have been introduced in the past. We don't have any doc that explains how to do it though.
 
--
Jesús García Crespo

Prathmesh

unread,
Feb 12, 2013, 5:04:16 PM2/12/13
to qubi...@googlegroups.com
Hi Jesus,

 So I have progressed a little by making the necessary additions of the new Taxonomy term and values for it in QubitTaxonomy.php & taxonomyterms.yml files. I also added a chunk of code to the lib/task/migrate/QubitMigrate110.class.php & arUpgrader110.class.php files, following the example of field "ACCESSION_RESOURCE_TYPE_ID", let me know if thats right. OR should I create a file similar to arMigration0094.class.php which I came across in the following commit :
https://github.com/artefactual/atom/commit/9dfc3b43a86a95cff3c9c6ec622284de8fce1fc2

After which I wanted to know is there a need for me to run an upgrade step, so that those changes in the migration file to be implemented , if Yes how to do that . Because as of now , those changes are not reflecting in my DB table of taxonomy, as its not showing the new "field Id" I created within the table.

Thanks for the help !!
-Prathmesh


Jesús García Crespo

unread,
Feb 20, 2013, 10:51:03 PM2/20/13
to qubi...@googlegroups.com
Hi Prathmesh,

I'm glad to hear that you are doing good progress.

To be honest, I'm not clear on how are you going to maintain your schema changes if they are not going to be merged into AtoM. I added that migrations directory so we can have individual migration scripts in an specific way so 1.x and 2.x users can coexist at the same time. If you add a file there, it will get overwritten by us in future merges when you are pulling changes and that may be a problem.

It would be nice if you can adapt the SQL upgrade system to keep a separated directory of schema change upgrades, but that won't be an easy task. Other option is to just do your changes as needed in the database and config/schema.yml (remember to run php symfony propel:build-model and propel:build-sql!). At some point you may get some conflicts with upstream, but nothing that you can't fix manually :)

Also, it would be awesome if you can add some docs in the wiki of the process. Thank you :)

Please write us if you have more questions.

Regards,

--
Jesús García Crespo,
Software Engineer, Artefactual Systems Inc.
http://www.artefactual.com | +1.604.527.2056
Reply all
Reply to author
Forward
0 new messages