DataMapper ORM v1.8.0 |
[eluser]rherriman[/eluser]
I understand the notion of junctions, of course. I just didn't understand why defining a reciprocal relationship must STILL interpret the relationship as one way, as opposed to $product->related->get() using a UNION to filter the products like so: Code: SELECT products.* FROM products LEFT JOIN products_products ON products.id = products_products.product_id WHERE products_products.related_id = 10 Saving the "inverse" relationship as well just seems like an unnecessary waste. That's all I'm trying to say.
[eluser]IgnitedCoder[/eluser]
Why oh why oh why? Works just fine when I use Apache2, but Nginx it just won't work. I've got both servers setup Apache and nginx. I stop nginx, start apache and run the same code and no issues, stop apache, start nginx and this shows up. Here's the kicker... its a simple model Code: class User extends DataMapper{ Fatal error: Call to a member function field_data() on a non-object in /home/devwebtalk/workspace/www/dev/system/database/DB_driver.php on line 889 Please help... Oh its PHP 5.3.3, MySQL 5.1, apache 2 and now nginx 1.0 with PHP-FLM, which outperforms apache big time. We're expecting millions of hits and we need a comet server which nginx supports very well so I have to get DM working for this. Please help WanWizard!
[eluser]WanWizard[/eluser]
@rherriman, An ORM is about objects, and relationships between them. And not about writing the most optimal SQL for every question you can think of. Nobody's stopping you from adding a method to your Product model that runs a custom query. Code: function mycustommethod($where)
[eluser]WanWizard[/eluser]
@BrendanRehman, That's an error in the CI database driver, so not related (directly) to Datamapper. DB_Driver's field_data() method runs a query, and expects a DB_Result object in return. It then calls the field_data() method of that object to get the table information. The query that runs is "SELECT * FROM table LIMIT 1", not exactly complicated. Assuming you autoload your database library, could you add this at the top of a controller method you can call? Code: // replace table by a valid table name
[eluser]IgnitedCoder[/eluser]
@WanWizard, Here's what came back from the call. Looks right... Is this a bug in CI I need to report! Code: string(27) "SELECT * FROM users LIMIT 1" object(CI_DB_mysql_result)#33 (8) { ["conn_id"]=> resource(31) of type (mysql link) ["result_id"]=> resource(64) of type (mysql result) ["result_array"]=> array(0) { } ["result_object"]=> array(0) { } ["custom_result_object"]=> array(0) { } ["current_row"]=> int(0) ["num_rows"]=> int(1) ["row_data"]=> NULL }
[eluser]IgnitedCoder[/eluser]
@WanWizard, I found the issue... turns out one of the developers added a new field to a table on his local machine, uploaded the new code and of course his code was looking for a field that didn't exist on the server. AGGGHHH I wish error messages were clearer!
[eluser]WanWizard[/eluser]
Shall I add a "Something not found. Please smack your developer" message?
[eluser]IgnitedCoder[/eluser]
Please do so as an easter egg in DM... that only a few know how to call. My only concern would be when I'm the developer that needs to get smacked. LOL
[eluser]WanWizard[/eluser]
Should be fixed again. My server was down, and I'm out of the country at the moment. Took some time to find someone to fix the issue... |
Welcome Guest, Not a member yet? Register Sign In |