Re: new form fields using QubitProperty, the Qubit i18n key value storage

74 views
Skip to first unread message

Jesús García Crespo

unread,
Dec 22, 2011, 2:26:36 PM12/22/11
to Django Boonman, qubit-dev
Hi Django,

2011/12/22 Django Boonman <d.bo...@ejbdesignery.nl>
we are making progress doing our own stuff in the code. I have an important question for you. Peter van Garderen mentioned that it was possible to add something like 'property-fields'. Instead of adding new columns to a table, it was better to add 'property-fields' in a more generic way without having to update the databaseschema. Does it sound familiar?

Yes, sure, that will make things much easier! You can do that using the "property" entity [1], mapped in the QubitProperty class [2]. Please notice that the model supports i18n and so we do in the forms.
 
I think you have already done things like that, could you point me to a place in the code or a php file?

We do extensive use of properties in our RAD metadata plugin. You can find it in plugins/sfRadPlugin [3]. Pay special attention to sfRadPlugin.class.php [4], a class wrapper which dinamically creates class properties via the magic methods __get() and __set() to make your new fields available. You can find a good example in the editAction [5].

Let me know how it goes. I believe that understanding the code I linked you above is going to help a lot.

As you can see I am also sending this email to qubit-dev for the sake of other developers.

Happy Holidays! :-)


--
Jesús García Crespo,
Software Engineer, Artefactual Systems Inc.
http://www.artefactual.com | +1.604.527.2056

django boonman

unread,
Jan 4, 2012, 6:58:10 AM1/4/12
to Qubit Toolkit Developers
Ok thanks, btw if you have an array of values, make sure to serialize
it before writing it to the database.
And unserialize it when reading it back from the database.

Django Boonman

On Dec 22 2011, 8:26 pm, Jesús García Crespo <je...@artefactual.com>
wrote:
> Hi Django,
>
> 2011/12/22 Django Boonman <d.boon...@ejbdesignery.nl>
>
> > **
> > we are making progress doing our own stuff in the code. I have an
> > important question for you. Peter van Garderen mentioned that it was
> > possible to add something like 'property-fields'. Instead of adding new
> > columns to a table, it was better to add 'property-fields' in a more
> > generic way without having to update the databaseschema. Does it sound
> > familiar?
>
> Yes, sure, that will make things much easier! You can do that using the
> "property" entity [1], mapped in the QubitProperty class [2]. Please notice
> that the model supports i18n and so we do in the forms.
>
> > I think you have already done things like that, could you point me to a
> > place in the code or a php file?
>
> We do extensive use of properties in our RAD metadata plugin. You can find
> it in plugins/sfRadPlugin [3]. Pay special attention to
> sfRadPlugin.class.php [4], a class wrapper which dinamically creates class
> properties via the magic methods __get() and __set() to make your new
> fields available. You can find a good example in the editAction [5].
>
> Let me know how it goes. I believe that understanding the code I linked you
> above is going to help a lot.
>
> As you can see I am also sending this email to qubit-dev for the sake of
> other developers.
>
> Happy Holidays! :-)
>
> [1]http://code.google.com/p/qubit-toolkit/source/browse/trunk/config/sch...
> [2]http://code.google.com/p/qubit-toolkit/source/browse/trunk/lib/model/...
> [3]http://code.google.com/p/qubit-toolkit/source/browse/trunk/plugins/sf...
> [4]http://code.google.com/p/qubit-toolkit/source/browse/trunk/plugins/sf...
> [5]http://code.google.com/p/qubit-toolkit/source/browse/trunk/plugins/sf...

Jesús García Crespo

unread,
Jan 4, 2012, 2:39:28 PM1/4/12
to dja...@ejbdesignery.nl, qubit-dev
Hi Django,

On Wed, Jan 4, 2012 at 3:58 AM, django boonman <dja...@ejbdesignery.nl> wrote:
Ok thanks, btw if you have an array of values, make sure to serialize
it before writing it to the database.
And unserialize it when reading it back from the database.

This is basically what I said - is there a reason why you are repeating it?

But it only applies to specific fields: languages and scripts.

Regards,

-- 

django boonman

unread,
Jan 5, 2012, 4:52:41 AM1/5/12
to Qubit Toolkit Developers
It was just info for all the other developers. You are right it
appllies to languages and scripts and for your own property fields
which involve array values.

Django
Reply all
Reply to author
Forward
0 new messages