Questions tagged [xpdo]

OpenExpedio is our name for open extensions to PDO. It's a light-weight ORB library that takes advantage of the newly adopted standard for database persistence in PHP 5.1+, PDO.

About the OpenExpedio Project

OpenExpedio is our name for open eXtensions to PDO. It's a light-weight ORB (object-relational bridge) library that works on PHP 4 and 5, and takes advantage of the newly adopted standard for database persistence in PHP 5.1+, PDO. It implements the very simple, but effective Active Record pattern for data access.

But OpenExpedio is a little more than a simple pattern implementation. It's a PDO implementation for PHP 4 and 5.0.x (where native PDO extensions are not available), a way to abstract business objects from the actual SQL queries and prepared statements used to access a relational database structure representing them, and a way to easily describe and provide optimized implementations of an object model for multiple target database platforms.

Object/Relational Persistence Framework

OpenExpedio is not a query abstraction tool, so the generated classes and maps are targeted at a specific platform to get you started. You just add your own methods and SQL to the generated classes to implement your application-specific business logic. XPDO was inspired by the need to provide an object-oriented API for a web application that is easy to develop with and maintain, and could be optimized as much as possible for the database platform it was being deployed on. And it needed to provide this with as small a code footprint as possible. For this reason, it specifically avoids the approaches of parsing and/or generating platform agnostic SQL that often doesn't take advantage of important performance-related features on each platform, or of relying on proprietary query expression languages that often generate unoptimized SQL in favor of supporting more platforms.

What is an ORB?

I refer to xPDO as an Object Relational Bridge, or ORB for short, because I like it better than the more popular ORM acronym, which stands for Object/Relational Mapping, and the more concise OPF, or Object Persistence Framework, just doesn't sound as good as ORB does. It has been adopted previously by several other projects including the Apache OJB project for J2EE, and now Modeling for Python (inspired by NeXT Software Inc.'s Enterprise Object Framework).

(source)

21 questions
4
votes
2 answers

How to show MySQL errors from a failed Modx/xPDO query object?

How do I show the error mysql throws when I try to insert data into a custom table and the insert fails? For example, below a bit of code that should(will) fail with an SQL error. $insert = "some insert sql statement that will fail"; $myquery =…
Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
2
votes
2 answers

How to convert SQL where LENGTH() condition to xPDO?

How do I express the where clause in this: select * from TABLE where LENGTH(COLUMN) > 0 in xPDO? $criteria->where(array('LENGTH(customer_po_num):>' => '0')); does not work, it results in something like…
Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
1
vote
0 answers

PDO unbuffered queries in MODX

There are many line in my MODX error log stating that SQL queries have failed because unbuffered queries are active. The error line is like this: Cannot execute queries while other unbuffered queries are active. Consider using…
1
vote
1 answer

How to correctly define index aliases in Modx/xPDO models?

I have a couple of tables that relate to each other in a couple of different ways in my model, a table for fund requests that will both refer to the Entity table for a client and an employer - so it needs 2 indexes, what is the correct way to set up…
Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
1
vote
3 answers

Faster way to populate modx placeholders in a form from related objects?

I have a couple of related objects in a database that I need to update from the same form. It's a simple address object related to a contact object VIA 1:1 relation. I can swear that when I was retrieving the object at one point I was setting all…
Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
1
vote
1 answer

What is causing this modx xpdo error?

I have a custom extra for modx revolution, but it is throwing the error: [2014-06-28 15:06:21] (ERROR @ /index.php) Error 42S02 executing statement: Array ( [0] => 42S02 [1] => 1146 [2] => Table 'db_name.modx_static_values' doesn't…
Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
1
vote
2 answers

Modx: getCollection query is not working

Inside my processor class I have a statement that grabs all the projects from a db table and formats them to be displayed. This method does not work and halts at the getCollection call. class GlobalLinkSettingsProcessor extends…
dnelson
  • 467
  • 1
  • 4
  • 16
1
vote
2 answers

Loading base packages in xPDO

I once spent over an hour reverse engineering the xPDO constructor to figure out how to load base packages upon instantiation. Unfortunately, I have lost that little snippet of code! And I'm left with this. $this->database = new xPDO( …
Ian Brindley
  • 2,197
  • 1
  • 19
  • 28
0
votes
1 answer

modx xpdo is taking a long time to refresh data

I am using xpdo in MODX Revolution 2.7.3 to insert and extra data from custom tables in the same database as the modx installation. Everything works fine except that it takes about 20 minutes for changes in the tables to show up in the xpod…
Sheils
  • 323
  • 2
  • 22
0
votes
1 answer

xpdo - insert multidimensional arrays into db-table - up to 5 rows at once

I have a form in which the user can add up to 5 counters with different values, beides a lot of different other values via inputs and selects. Most of the data shall be written to different existing database-tables, which is so far working fine for…
EM Em
  • 270
  • 1
  • 3
  • 17
0
votes
0 answers

PDO prepared statement returns not correct lastInsertId

My head is close to explode. I'm trying to insert a lot of rows to database using prepared statements (it's MODx cms). Query looks like: INSERT INTO {$table} (`fio`, `address`, `code`) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE fio =…
0
votes
1 answer

Modx Revolution with several MIGX TVS in same template. Why am I getting "max_user_connexions" xpdo error in Firefox 58.0.1?

I am working on a site in MODX 2.6.1-pl and have a template that uses 7 different MIGX template variables. Everything seemed to work fine to work fine initially, but now some pages cause many (several hundred) of the following xpdo errors when I try…
0
votes
2 answers

Extending Modx modResource schema errors

I'm trying to extend the modx modresource object, but keep getting errors & I can't seem to figure out why. It is related to the schema (I think) but everything looks correct. Schema:
Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
0
votes
0 answers

xpdo modx how to add a condition ON DUPLICATE

I have a very simple MySQL table and I need to execute this query: INSERT INTO modx_good (uuid,name) VALUES ('1','name') ON DUPLICATE KEY UPDATE uuid='1', name='name'; My table is modx_good: `id` int(11) NOT NULL AUTO_INCREMENT, `uuid`…
Asylzat
  • 197
  • 5
  • 17
0
votes
1 answer

modx xpdo insert via schema updated. queries now fail

title is probably not correct but here's the situation. In modx using migx i've created a custom package for a custom table. it looked this:
Amelia
  • 320
  • 6
  • 16
1
2