Hi All,
Chris and I talked out of band and we agree that the following proposal
should work out right:
https://github.com/ledgersmb/LedgerSMB/wiki/PGObject-(database-mapped)-classes-API
Regards,
Erik.
On Thu, Mar 9, 2017 at 9:46 PM, Erik Huelsmann <ehu...@gmail.com> wrote:
> Hi Chris,
>
> Could you help me with the following: our API for PGObject-based classes
> has only one constructor (the regular 'new' constructor). Many (but not
> all) classes can be passed a single 'id' value. The constructed object
> sometimes has a 'get' method.
> In some cases, this 'get' method returns a new instance, in other cases,
> the getter initializes fields in the 'current' instance.
>
> I'm thinking:
> * The fact that the getter sets up the current instance makes me want
> to use the getter with the 'primary key' (id) to retrieve the object
> from
> the database. However, this means we can't require any fields in the
> object.
> * If the 'get()' method would be a class-level constructor (like new),
> always
> returning a new instance, we could start requiring fields in our classes
> (because the getter will make sure that required values are retrieved
> from
> the database before the field checks happen)
>
> Would it be an idea to require a minimum number of methods and class
> methods to be implemented on a LedgerSMB::PGObject, like the ones above,
> but maybe also "save", "remove" (not delete, as that's a reserved word in
> Perl), ... (any others?)
>
> The API for the getter would include some kind of database connection as
> the argument, as well as a hash (to request a single object) or an array of
> hashes (to request multiple objects).
>
>
> Do you have any input on the matter?
>
>
> Regards,
>
> --
> Bye,
>
> Erik.
>
> http://efficito.com -- Hosted accounting and ERP.
> Robust and Flexible. No vendor lock-in.
>
--
Bye,
Erik.
http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Ledger-smb-devel mailing list
Ledger-smb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel