Topic: Idiorm

No problem, I'm learning to use idiorm to integrate it into the plug-ins.
Yesterday I made a base for helped plugin for the sandbox that creates a database of contacts and I found very easy to use but I still have much to learn.

I believe that you can do with this framework of of Monstra a very powerful cms and fast.

I have a simple question, as I would only see a contact.

<?php
foreach (contact_list as contact) :
   $contact->name
   $contact->email
   $contact->description
endforeach; ?>

In this way I see all contacts

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: Idiorm

You can select a single record https://github.com/j4mie/idiorm

Monstra Loves You! Give some love back!

Re: Idiorm

I'm going to give you an example of how I do it.

// sandbox.admin.php
// delete contact
if (Request::post('del_contact')){
   $id = Request::post('id');
   $contact = ORM::for_table('contact')->find_many($id);
   $contact->name = Request::post('name');
   $contact->email = Request::post('email');
   $contact->phone = Request::post('phone');
   $contact->save();
}
$contact_list = ORM::for_table('contact')->find_many();
View::Factory(path)
                    ->assing('contact_list',$contact_list)
                    ->display();
// index.view.php
<?php foreach ($contact_list as $contact): ?>
  <div>
  <?php
     $contact->name 
     $contact->email 
     $contact->phone 
  ?>
 </div>
<?php endforeach; ?>

If I have multiple contacts it shows me all and I just want to you to teach me that I want.
Would have that change find_many find_one?

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: Idiorm

https://github.com/j4mie/idiorm#single-records

Monstra Loves You! Give some love back!