Jump to content

fry2010

Members
  • Posts

    326
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.forextradingsignalservice.com

Profile Information

  • Gender
    Not Telling
  • Location
    UK

fry2010's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. ok, obviously I didn't get my head round it right the first time. Looks like an elegant solution. Cheers ignace!
  2. ok. Cheers guys. As always some great insight. Igance, that looks like a nice solution. So would I be right in saying that, if a user updated their contact table, then in order to get these new values I would have to load ALL their account info with this proposed method? Basically I just create an sql to deal with all account resources (joins all tables) even though I may not want table 'x', I will get its columns anyway? Sounds like a clean solution, although not as fully optimized as possible if I understand your method correctly.. unless of course I modified it to deal with more granular requests..
  3. I have looked at doctrine before when looking into symphony. It looks like a good solution, but I am still not sure how it would deal with joined queries. Could you possibly direct me to the correct part in the documentation that relates to that or even an example?
  4. How could I create a class that has a single responsibility yet also can obtain data from other objects, whilst using joins? I'll give an example: I am obtaining user account data and then wish to grab their contact information and profile information, both of which are in different tables. My table structure: create table user_accounts ( userAccountId mediumint( unsigned NOT NULL AUTO_INCREMENT, email varchar(255) not null, password varchar(40) not null ); create table exists profile ( groupAccountId mediumint( unsigned not null, avatar varchar(160) not null DEFAULT '', groupName varchar(160) not null DEFAULT '' ); create table user_contact_details ( contactDetailId mediumint( unsigned not null AUTO_INCREMENT, userAccountId mediumint( unsigned not null, addressLine1 varchar(60) not null DEFAULT '', street varchar(60) not null DEFAULT '', postcode varchar( not null DEFAULT 1, telephone varchar(15) not null DEFAULT '', mobile varchar(15) not null DEFAULT '' ) So, if I want to grab information from all tables, but grab them from one class, how would this reflect on single responsibility? How would you go about designing a class for this?
  5. Just in case anyone wondered, I eventually got a fairly good polymorphic design setup (at least I think so): Created a base class called 'profileObject'. This had a static method called 'getProfileObject(userObject $userObject)'. As you can see this accepted an object of type userObject. This method auto-loaded the required sub-class. For example if the userObject account type was an affiliate, then it would load the sub-class called 'affiliateProfileObject()'. The sub-class extended an abstract class called 'Profile'. This obviously set out the required methods and properties. Now anytime I want to get profile of a user object I simply call: $userProfileObject = profileObject::getProfileObject($userObject); Then if I need to access a property of that users profile I can simply use $userProfileObject->avatar; Hope this helps someone else. Of course if anyone wants to make suggestions on how this could be improved etc I would be interested to hear it. cheers.
  6. I have been reading a lot on polymophism and understand the basics, however when it comes to implementation on something as diverse as different user account types, I struggle to make sense on how best to achieve it. So wondered if someone could give me some pointers as to achieve it: My database tables: user_account ( id mediumint(7)... firstName varchar(120)... lastName varchar(120)... accountTypeId tinyint(1)... etc... ) account_type_1_profile ( userId mediumint(7)... getEmails tinyint(1)... aboutMe... showDemo... ) account_type_2_profile ( userId mediumint(7)... differentProfileSetting1 tinyint(1)... differentProfileSetting2 tinyint(2)... ) As you can see I have a single table for all user account types, but different profile tables. I felt this was best as different accounts will have different profile information. Also I will be having user groups into the mix, so again create another table for group profile settings and a user to group table. Now when creating accounts I have to create a main account, and also a profile for the user depending on the type of user. My current system is: class userClass() class userAccountClass() - create and edit the account table class userProfileClass() - create and edit the user profile Within userAccountClass() I have a method called createAccount() - which creates any type of account. within userProfileClass() I have a method called createProfile() - which is where my issues start to arrive. How can I build it to be polymorphic given that there are a variety of different account profile types? How do I avoid using a big switch statement or multiple methods to achieve same result? Suggestions welcome..
  7. Ok that clarifies a lot for me. You seem to understand exactly the issue I am getting at here, the fact of getting the pagination to work with the result set from the model, without being integrated. I just wanted to avoid having to request a method twice with effectivly the same sql query. So I believe my design issue is with my control aspect. Cheers Kevin
  8. I know this is a common question in relation to object oriented coding, but the answers I see in other places don't really explain how to deal with my situation (probably a very common one). Basically I have created an abstract class 'model', I then want to extend on this with class 'userModel'. Now here is the issue, I also have a third class 'pagination' that I want to be a available to the 'userModel' class. Is any of these approaches the correct way: 1) I could extend the 'model' class with the 'pagination' class, then extend the 'pagination' class with the 'userModel' class. So 'model' -> 'pagination' -> 'userModel' - However these just seems wrong to extend the pagination class 2) Put the 'pagination' methods inside the 'model' class and just extend the model class. So 'model' -> 'userModel'. - However doesn't this go against the seperation of behavoirs with classes? 3) Don't extend the pagination class, but call it seperatly in my control code. The typical answers I see basically suggest that the structure of the classes are wrong if I find I come accross this issue, yet to me the classes seem to be seperated logically. As in they each lay the plans to well defined behavoirs. So I don't see how they can be re-structured. Please enlighten me on where I am going wrong with my thinking here...
  9. Iv been using the tutorial here: http://akrabat.com/zend-framework-2-tutorial/ I wondered if anyone else was finding issues such as the skeletonApp downloaded from git not working correctly? I managed to get it working, however when setting up the 'Album' application, it seems to just mess the whole lot up? So wondered if anyone has recently been using this tutorial and came accross the same things I have, and also offer possible solutions? thanks.
  10. ok yeah i was wrong. Capitlization error. Cheers.
  11. I take it I have upset you guys by calling joomla a big pile of dump?
  12. Clearly it's not. 404 errors mean 'this is not pointing to the right location' Really? It's possible to point to the correct location and still get a 404 not found error. You have heard of the php function, header() right? Just becuase something declares itself as 'not found' does not make it correct. That is down to the system (joomla) throwing this '404' header, even though the resource is there.
  13. hey, Im working with possibly the biggest pile of dump CMS, joomla 2.5. I am having an issue getting a Jquery ajax call to request a .php file within a component directory. Basically joomla is throwing a 404 not found. I have made sure it is correctly pointing to the right location, its just throwing this error. Any ideas?
  14. I have got around the problem now, by setting the foreign fields to allow NULL values, instead of setting to NOT NULL. I also discovered that you cant limit a load data infile, but it is a high requested feature in the mysql boards. Just thought I would record that here in case anyone else runs into a similair problem.
  15. also, is there a way to LIMIT a load data infile? It appears that it doesnt insert all 1 million rows in one go, so I am using IGNORE XXX LINES to skip them. Is there a way to see how many of those rows in the CSV file that had been read?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.