![]() |
[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) (/showthread.php?tid=18196) |
[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]ZeusChicago[/eluser] You must have been typing this as I updated my post above. I did notice I was using the count the wrong way (see bottom of my last post) So I did a test and changed Oh and I am using the latest version of CI and Datamapper (upgrade from non overzelous) ![]() Code: $subModel->join_related('subscriptiontypes')->get(); to Code: $subModel->join_related('subscriptiontypes')->count(); and echoed the result (which was two) and then checked the profiler output to see the query run was Code: SELECT COUNT(*) AS `numrows` but flipping back to this Code: $subModel->join_related('subscriptiontypes')->get(); still only outputs one record and the profiler shows the following query Code: SELECT `subscriptions`.*, `subscriptiontypes`.`ID` AS subscriptiontype_ID, `subscriptiontypes`.`NAME` AS subscriptiontype_NAME, `subscriptiontypes`.`PRICE` AS subscriptiontype_PRICE, `subscriptiontypes`.`displayname` AS subscriptiontype_displayname, `subscriptiontypes`.`description` AS subscriptiontype_description which when run from phpmyadmin does produce 2 records.... [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]ZeusChicago[/eluser] Hum, ok using your count($object->all) suggestion the following Code: $subModel = new Subscription(); $this->data['previousSubDataCount'] does return 1 $this->data['previousSubData'] does contain 1 record however, in the profiler window, the following query is returned from the above Code: SELECT `subscriptions`.*, `subscriptiontypes`.`ID` AS subscriptiontype_ID, `subscriptiontypes`.`NAME` AS subscriptiontype_NAME, `subscriptiontypes`.`PRICE` AS subscriptiontype_PRICE, `subscriptiontypes`.`displayname` AS subscriptiontype_displayname, `subscriptiontypes`.`description` AS subscriptiontype_description Which when I copy and run in phpmyadmin does in fact return the two rows I am expecting ![]() Code: ID fa_user_id subscriptiontype_id startdatetime enddatetime paypaldata subscriptiontype_ID subscriptiontype_NAME subscriptiontype_PRICE subscriptiontype_displayname subscriptiontype_description [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]OverZealous[/eluser] Whatever the query returns is what DMZ is going to process. You must be doing something different. if the query returns X results, then DMZ will return X results. It's not like it does something weird (well, not since I changed the way the ->all array is built). There's just nothing in your example I can see that would cause you to see different results. Are you 100% sure the query you listed above returns 2 results, and it's not just your count() query that produces 2 results? If you want to be sure, insert some debugging code into DMZ directly. Look at the method _to_object near line 4533. You can check the number of rows (via count($result)) from there. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]OverZealous[/eluser] Zeus, are you seeing two rows with the same ID? If so, you are using an older DMZ (or have it configured to use the old all_array method). The newest one allows for multiple results. That's the only thing I can see that would be happening. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]ZeusChicago[/eluser] Hum so I went in and added the following right after I do the $subModel->all(); $subModel->check_last_query(); and I get the following query which when run in phpmyadmin also returns 2 rows Code: SELECT `subscriptions`.*, `subscriptiontypes`.`ID` AS subscriptiontype_ID, resultset (the ID's are differant) Code: ID fa_user_id subscriptiontype_id startdatetime enddatetime paypaldata subscriptiontype_ID subscriptiontype_NAME subscriptiontype_PRICE subscriptiontype_displayname subscriptiontype_description Maybe I botched the upgrade from datamapper to datamapper overzelous. Let me go down checking that route and will re-install the overzelous version from scratch. Crosses fingers and hope this was an ID10T error on my part lol Z [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]OverZealous[/eluser] @ZeusChicago Well, the upgrade is really just "copy datamapper.php over the old one, update your config". So, I don't know how it could be botched. One thing you could try doing is running this code, and see if you still get one row: Code: $subModel->query( /* query you pasted from above, as a string */); I don't know what it means if you get different results, because they work basically the same. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]ZeusChicago[/eluser] Well I did find that I was using 1.5.0 DMZ instead of the 1.5.2 DMZ so I reinstalled dmz and am now for sure suing 1.5.2 and when I refreshed my page that was working before, I now get this Code: A Database Error Occurred its not liking `subscriptiontypes`.` (its missing a *') [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]OverZealous[/eluser] Is subscriptiontypes a direct relationship or a deep relationship? Please post the code, too (not just the error). I had a bug from just a few pages back that I fixed in 1.5.2 that looks exactly like your output. Like I said, though, I fixed it in 1.5.2. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]ZeusChicago[/eluser] Hum I doublechecked the /application/ilbraries/datamapper.php version (it was 1.5.0 before) and the header now has * @version 1.5.2 ($Rev: 245 $) (Based on DataMapper 1.6.0) so I am for sure using 1.5.2 The code I had before didnt change so its still Code: $subModel = new Subscription(); here are my models for subscription and subscriptiontypes Code: <?php Code: <?php [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 09-16-2009 [eluser]ZeusChicago[/eluser] here are the tables themselves with populated data [code] CREATE TABLE IF NOT EXISTS `subscriptions` ( `ID` int(10) unsigned NOT NULL auto_increment, `fa_user_id` int(10) unsigned NOT NULL, `subscriptiontype_id` int(10) unsigned NOT NULL, `startdatetime` datetime NOT NULL, `enddatetime` datetime NOT NULL, `paypaldata` text NOT NULL, PRIMARY KEY (`ID`) ) INSERT INTO `subscriptions` (`ID`, `fa_user_id`, `subscriptiontype_id`, `startdatetime`, `enddatetime`, `paypaldata`) VALUES (32, 1, 2, '2009-08-04 10:59:19', '2009-09-04 10:59:19', 'NA^|^NA'), (33, 1, 3, '2009-09-11 13:02:40', '2009-10-11 13:02:40', 'mc_gross=4.99^|^protection_eligibility=Eligible^|^address_status=confirmed^|^payer_id=6DQTLABWCDYB4^|^tax=0.00^|^address_street=1 Main St^|^payment_date=11:05:32 Sep 11, 2009 PDT^|^payment_status=Completed^|^charset=windows-1252^|^address_zip=95131^|^first_name=Jim^|^mc_fee=0.44^|^address_country_code=US^|^address_name=Jim Bodine''s Test Store^|^notify_version=2.8^|^custom=sub|1 month|3|4.99|One Time Ad|1|2009-09-11 13:02:40^|^payer_status=verified^|^[email protected]^|^address_country=United States^|^address_city=San Jose^|^quantity=1^|^verify_sign=A1rhWvTWIcaaOUKJK9YefEh4kefhALqdYjIAtCRbM-Wse-HqHsHVOelU^|^[email protected]^|^txn_id=75V94890TT065421G^|^payment_type=instant^|^payer_business_name=Jim Bodine''s Test Store^|^last_name=Bodine^|^address_state=CA^|^[email protected]^|^payment_fee=0.44^|^receiver_id=XZ5KX2Y9VM62A^|^txn_type=web_accept^|^item_name=One Time Ad^|^mc_currency=USD^|^item_number=^|^residence_country=US^|^test_ipn=1^|^handling_amount=0.00^|^transaction_subject=sub|1 month|3|4.99|One Time Ad|1|2009-09-11 13:02:40^|^payment_gross=4.99^|^shipping=0.00^|^cmd=_notify-validate'); CREATE TABLE IF NOT EXISTS `subscriptiontypes` ( `ID` int(10) unsigned NOT NULL auto_increment, `NAME` varchar(45) NOT NULL, `PRICE` varchar(1024) NOT NULL, `displayname` varchar(128) default NULL, `description` text, PRIMARY KEY (`ID`) ) INSERT INTO `subscriptiontypes` (`ID`, `NAME`, `PRICE`, `displayname`, `description`) VALUES (1, 'NOACCESS', '0|0', NULL, NULL), (2, 'TRIAL', '30|0|180|0|365|0', '30 Day Free Trial', 'We our offering, for a limited time a 30 day free trial to Find Us A Breeder.com. This will allow you a free 30day standard subscription which will allow you to check out the site and its standard features. Were quite confident that after the first 30 days, you will see a increase in leads and sales from us that you will be back to signup for one of our packages.'), (3, 'ONETIME', '30|15.99', 'One Time Ad', 'Select this package if you have just one ad you would like to place on our currently avaiable puppy listing. This single ad will be viewable by all our customers. This package does not include the following that our other packages do such as being able to post upcoming litter listings, being able to post multiple ad''s, being able to post featureed ad''s nor does it include a listing in our breeders directory'), (4, 'STANDARD', '30|9.99|180|49.99|360|95.99', 'Standard Breeder Packages', 'This is our standard breeder package option. You can choose to pay Monthy, Bi-Monthly or Yearly. This packages includes being able to post multiple ad''s in our available puppies section, a listing in our breeder listing, and the ability to post in our breeder services section(stud service listings).'), (5, 'PREMIUM', '30|19.99|180|99.99|360|191.99', 'Premium Breeder Packages', 'This is our standard breeder package option. You can choose to pay Monthy, Bi-Monthly or Yearly. In addation to the standard options above it also inculdes being able to post multiple ad''s in our upcoming puppies section and the ability to flag one of your ad''s as a featured ad, which will including it on our home page as well as prominant area''s of all pages in teh website. Youre listings and profile will also be displayed as one of our premium breeders calling more attention to it then our standard ads.'), (6, 'PREMIUM_WEB', '30|29.99|180|149.99|360|287.99', 'Custom Website + Premium Breeder Pack |