Re: EOModel derived attributes

From: Chuck Hill (chil..lobal-village.net)
Date: Mon Feb 09 2009 - 20:04:09 EST

  • Next message: getsharp: "Re: EOModel derived attributes"

    On Feb 9, 2009, at 4:59 PM, getsharp wrote:

    > I only use derived attributes to represent a concatenation of
    > several columns as a single attribute, eg fullName =
    > CONCAT(first_name,' ',last_name)
    >
    > It's helpful for building qualifiers, eg fullName = 'Joe Citizen'
    >
    > Two things bug me though:
    >
    > * non standards compliant databases leaving me with database
    > specific syntax in my model (I'm looking at you MySQL as per my
    > example)

    That is because you are not using prototypes for this and you should
    be. Database specific knowledge belongs in a prototype. Define a
    "fullName" prototype for each database and use this to define the
    attribute.

    > * displaying derived attributes where an EO is not a result of a
    > database fetch, eg newly inserted EOs

    Override fullName to return firstName() + " " + lastName()

    > It's probably less pain to just add methods to my Entity classes for
    > a) returning concatenated attribute values and b) returning
    > qualifiers in cases where I want to keep the clutter of building
    > them out of components.
    >
    > The small win of having ease of qualification results in 2 things
    > that bug me!
    >
    > Any thoughts on this?

    Looks solved to me. ;-)

    Chuck

    -- 
    Chuck Hill             Senior Consultant / VP Development
    

    Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects



    This archive was generated by hypermail 2.0.0 : Mon Feb 09 2009 - 20:04:49 EST