ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

[Deprecated] DMZ 1.6.2 (DataMapper OverZealous Edition)

November 23, 2009 11:54pm

Subscribe [46]
  • #376 / Feb 23, 2010 8:01pm

    OverZealous

    1030 posts

    @NachoF
    Then you don’t have a relationship named “group” on the User object.  I can’t think of another reason.

  • #377 / Feb 23, 2010 8:14pm

    NachoF

    171 posts

    I do have it.. in fact. If I force the form to have the error then it will display the error… weird.

  • #378 / Feb 23, 2010 10:38pm

    OverZealous

    1030 posts

    @NachoF
    Oops.  I found it.  It’s in the validate method.  Similar problem.  I’ll fix it now.  This one won’t be as simple, though.

  • #379 / Feb 23, 2010 10:44pm

    NachoF

    171 posts

    Its not critical though.. using isset seems to work

  • #380 / Feb 23, 2010 10:56pm

    OverZealous

    1030 posts

    @NachoF
    It’s actually a great find because I’ve come up with a better solution than previous.

    I’ve replaced the generic stdClass error object with a custom class.  This class automatically returns the empty string for any field, so this error could never happen.  It also has better documentation, so code completion will work to show the common options (string, all, transaction), as well as hinting for the field names.

    Another benefit is there is no need to set an empty string for every field anymore, (microscopically) reducing memory usage.  This all fits really well with the purpose of the 1.7 update (which is performance and cleanup).

    Thanks for finding it!

  • #381 / Feb 23, 2010 11:28pm

    NachoF

    171 posts

    great.. then I guess youre welcome….. about code completion.. do you have any ideas on how to use it on notepad++ (Windows)??.... When I hit ctrl+space I just get a bunch of generic options that dont serve any purpose.

  • #382 / Feb 23, 2010 11:32pm

    OverZealous

    1030 posts

    @NachoF

    Sorry, I don’t use Windows.  Chances are very good, however, that Notepad++ doesn’t support this style of code completion.  The new stuff I’ve added requires a full IDE that can parse all of the files and build a database of options.

    NB 6.8 just added rudimentary support for PHPDocs, so the huge block of @param and @method items at the top give it hints into which magic methods and fields exist on the DataMapper object.  I’m pretty sure I read that Eclipse with the new PHP plugin can do it, and ZendStudio may as well.

    Text-editor style programs almost never can do it, because they need to be able to see the entire project to provide information.

  • #383 / Feb 24, 2010 1:45am

    OverZealous

    1030 posts

    This is interesting.  I assumed (yeah, yeah, I know) that the new get_large_query method, sugessted by TheJim, would perform poorly for small result sets.

    Yet when I was testing, it actually improved performance, and reduced memory footprint for a 3 item query!  This is limited testing, to be sure, and everyone’s results will be a little different.

    However, I’m thinking of renaming it to something that suggests it should be used more often, and maybe recommending it for all results that are just going to be looped over.

    I don’t have a good name for it yet, though.  Any suggestions?

    My brainstorming list:
    • get_loop_only
    • get_for_looping
    • get_streamed / get_streaming (TheJim’s original name)
    • get_iterated
    • get_list
    • get_as_list
    • get_serial / get_series

    Any and all suggestions will be welcome!

  • #384 / Feb 24, 2010 8:09am

    NachoF

    171 posts

    Well, I dont know what the method does but if its what it does get_loop_only is a good name

  • #385 / Feb 24, 2010 1:19pm

    Oblique

    32 posts

    get_memory_sparing ? (although i suspect it sounds like indian speech in english, and not sure if it’s the thing this method is about)
    and also get_for_loop sounds like best choice in terms of self-description

  • #386 / Feb 24, 2010 2:40pm

    TheJim

    35 posts

    Well, as you might have guessed, I’m a little partial to get_streaming, but I think get_iterated and get_for_looping aren’t bad either.

    As for it helping with smaller result sets as well, I believe it’s mostly that the DataMapper constructor is a little heavy—which makes perfect sense for the “magic” provided.  I have a couple of ideas for further improving that, hopefully without complicating things too much, but it would probably be more involved than the enhancements I did suggest, and I haven’t gotten around to writing the code and checking if my ideas will even work.  Of course, even with a faster constructor, there would still be memory savings to the iterator/streaming approach, but less of a CPU savings.

    Anyway, I’m rambling.  I need to check out 1.7 and see what other goodies you’ve managed to fit in.  Thanks for the hard work, Phil.

  • #387 / Feb 24, 2010 7:33pm

    NachoF

    171 posts

    I was just wondering… about code completion… do you get help with attributes that are on the database??
    like
    $user->email?

    Im guessing not but I want to make sure… just downloaded Eclipse but Im not sure how to set it up to work with CI.

  • #388 / Feb 24, 2010 7:48pm

    OverZealous

    1030 posts

    @NachoF

    You don’t get help automatically, but that’s simply that they need to be defined in your model.  It’s very simple, and it looks something like this:

    /**
     * User
     *
     * @param string $username Login username
     * @param string $password Encrypted password
     * @param int $favorite_number
     * etc.
     */
    class User extends DataMapper {
    ...

    Alternatively you can define the actual variables inline, and that looks like this:

    class User extends DataMapper {
        /**
         * Login username
         * @var string $username
         */
        public $username;
        ...

    I prefer the former method, but it’s purely a matter of taste.

    As far as setting up an IDE…  Well, that always takes some effort.  Eclipse might not be a good starting place, because you have to manually set up so much.  I would have suggested Aptana (based on Eclipse) until they effectively dropped all PHP support in a recent upgrade.

    If you grab NetBeans with the PHP package, it’s pretty full-featured out the gate.  I’ve probably spent more time fiddling with the editor’s fonts and colors than making it work 😊

    My favorite feature is watching it auto-complete my complex Dojo Javascript libraries.  I have not seen another IDE handle those without any additional plugins.

    But I have used NetBeans in various forms for (yikes!) almost a decade now, so I’m a bit biased.  😛

  • #389 / Feb 24, 2010 7:52pm

    NachoF

    171 posts

    You are talking about the 25MB package on that link, right??... downloading right now.

  • #390 / Feb 24, 2010 7:54pm

    OverZealous

    1030 posts

    @NachoF
    Maybe.  I’m on a Mac, so mine says 23MB.  😜

    It’s the one that has PHP at the top of the column. 😊

    Edit: Should have added this link: http://netbeans.org/features/php/index.html

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases