Jump to content

Recommended Posts

Posted

I dont be an pro coder, but understand all what i want to know so far.

Now i try to understand the code from processwire. Espacially how PW does get and set data in the database.

I look Database....php, WireData.php and so on and many set() and get()-methods therein. And i know of the existence from $db.

But i dont understand or see which method(s) in which class(es) used for SQL-Statements - especially in the case of fields.

So i look the code from the example "event" from ryan. I see set() and get()-methods in event.php.

Can anyone help me and hands on me further?

Which methods and classes set and get data from the database?

How can i manipulate the sort-order?

Thank in advance.

I know how i can wrote and read in the DB with the $db, but i would like understand the processwire-way.

Posted (edited)

The processwire way is in 95% to use the API, and not to write directly to the DB. (Using direct access is for rare edge cases or maybe sometimes when create a module)

PS: Ah, it is your first post here. Welcome! :)

Edited by horst
  • Like 1
Posted

I dont understand the "event" example from ryan. Where are the methodes for set and get the variables from the db?

How can i write own modules without understanding this basics?

Thx

Posted

The sort column isn't explicitly set by the module. It's added by FieldtypeMulti::getDatabaseSchema(), which is a parent class of the event fieldtype.

  • Like 1
Posted

Ok, in the hookable method "___sleepValue()" in FieldtypeEvents.module.php in line 110 ive found:

$value->sort('date');

One questions is answered. Not 100% understand all the code but one big step further.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...