DataMapper ORM v1.8.1 |
[eluser]matyhaty[/eluser]
For those who are interested. Ive been trying to do the advanced relationships for this, which would help the searching (I think....) I have failed pretty badly!! Attached is a very basic implementation... (with SQL) http://s3d.co.uk/client_sites/DMTest.zip I must be doing something obviously wrong - or it could be my whole logic! Im on the verge for storing ID's in the qualification table, but it would be such a shame not to use the ORM properly Any help welcomed, advise, abuse or otherwise!!! regards EDIT: Ive updated the save part to the below - still doesnt work, but more on the right lines ithink ?? Code: public function index()
[eluser]Damir Sivic[/eluser]
Am I Doing This Right? there's so many "select ..." and "update ..." in debug report. Relationship many to many campaigns and categories with one join field, and I want to save data into relationship table Code: $c = new Camapign();
[eluser]matyhaty[/eluser]
Back to my qualifications problem!!! Attached is basic image which shows the flow..... With this setup I can quite easily access all the information for a person's qualifications.... Code: $p = new Person(2); The issue Im having is searching person for particular types of qualifications..... Story Board: 1) Get all persons in the system which have qualification type '6' 2) Get all persons in the system which have qualification type 6 AND 4 3) Get all persons in the system which have qualification type 6 OR 4 The previous posts try and do this, but can only do 1 and 3......
[eluser]WanWizard[/eluser]
Code: $p
[eluser]dejavu[/eluser]
<edit> bad question - I've been spoiled by using a similar ORM with slightly different behavior.
[eluser]WanWizard[/eluser]
[quote author="dejavu" date="1308209472"]<edit> bad question - I've been spoiled by using a similar ORM with slightly different behavior.[/quote] What kind of behaviour? There's always room for improvement, if you have a suggestion...
[eluser]Flyingbeaver[/eluser]
Hi folks, Reading the doc I have tried to use : Many-to-Many Reciprocal Self Relationships... Datamapper 1.8.1 With the following code : Model Code: class Service extends DataMapper { I have two tables : services and services_services services_services has 3 fields : id, service_id, related_service_id. Controller Code: $service = new Service(); I have the following error : Error Number: 1146 Table 'test_db.related_services_services' doesn't exist If I change table name I got no errors but fields values are NULL. Thx for your help !
[eluser]Flyingbeaver[/eluser]
Ok i have the solution : I have changed my get to array Code: $service = $service->get()->all_to_array( Thx dan for your great work, I can't wait to try fuel and see your work on this ![]()
[eluser]Anestetikas[/eluser]
Found a new problem to deal with. I have a DB with folowing tables funds -< inventories -< files -< documents All of these 4 tables has a many to many relations to languages and characteristics tables. There are like 2k rows in funds 5k in inventories 4mil in files and ~200k in documents. Every one of these rows has 0 1 or 2 relations to languages and characteristics. I want to get all related languages and characteristics to specific fund, inventory, file. If I do or_where_related: Code: $kalbos = new Language; Code: SELECT `languages`.`description` Code: +----+-------------+---------------------------+--------+------------------------------+------------------+---------+----------------------------------------------+------+-------------+ Query execution: Code: 34 rows in set (24 min 18.99 sec) Is there a way to get related languages for each object (its very fast), and then merge them into one $languages object? EDIT: Went around with getting ids all_to_array for each object, then merged ids to $langIDs array, then selected once again by where_in('id', $langIDs); Lots of code, but seems to get proper stuff in 0.04sec instead of 25minutes. |
Welcome Guest, Not a member yet? Register Sign In |