Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

ORM on item 22 Feb 2017 10:42 #15007

Hi Admin,

For starters, I really like the orm system! I have forked my project heavily but I am working through all the changes.
I came across some point, which I would like to share.

I have used the orm system to get a specific item like in the example:
$city = XxxxHelper::getData('city', array(
    'select' => 'name', 'population'
), 3); // Load the city #3

This does not seem to work for me, I get NULL and not an item object.
When I do is on the list model:
$city = XxxxHelper::getData('cities', array(
    'select' => 'name', 'population'
), 3); // Load the city #3
I get a list with one item, but then I have to do $list[0] to get the item.
Not a big issue, but also not as designed I guess?

Furthermore the relation bit seems not to work always, it looks as if you need to have the relation already declared to be able to use it.
When the relation is not in the model constructor in the class, you can not use it.
That might became a hairpuller if you are not aware of it, I am correct to state this?

thanks :)

Please Log in or Create an account to join the conversation.

ORM on item 22 Feb 2017 10:56 #15008

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Did you tried the alternative way :
$city = XxxxHelper::getData('city', array(
    'select' => array('name', 'population'),

    'id' => 3,  // HERE Load the city #3
));

EDIT : fixed the source code example
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.

ORM on item 22 Feb 2017 11:31 #15009

That works, but it is still on the list model, not on the item.
So you get an array back :)

When you do:
$city = XxxxHelper::getData('city', array(
    'select' => 'name', 'population',
    'id' => 3,  // HERE Load the city #3
));
it will not work, I get NULL

Please Log in or Create an account to join the conversation.

ORM on item 27 Feb 2017 19:05 #15016

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Ok, I found.

Should be better now.

changed :
classes/model/orm.php

I also updated my previous example. It is working now.
Coding is now a piece of cake
The following user(s) said Thank You: Romkabouter

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.087 seconds

  I found "cook" two days ago. Played around with it for a day and then within a day got rid of two legacy applications in IBM Lotus Domino Notes and replaced them with "cook". It was really easy. A piece of cake. Actually it was even easier than cooking. Cooking involves more work than developing with "cook". What can I say about "cook"? Great application great price for what it delivers great forum with a lot of information and fast responses active and friendly community fast forward moving development cycle So what should I say "Monsieur Le Cook"? Keep the good work going it will lead to success. Having become a paying member in the words of Edith Piaf may I say ..... non rien de rien ... je ne regrette rien. Vive La France.
FK (JED)
         

Get Started