Dear mister Sadjadi, It is not out of friendship that I answered you, but just to learn from it myself. And the other way around: if anybody did not answer your questions, it is not because of a lack of friendship, but merely because it takes some time to find a proper answer and in your case it often takes some time to understand the question. For instance the question in this thread could be compared to something like asking: "what is the difference between a horse and a specific stable?". The question shows you are mixing up different categories, contexts, terms. I didn't imply any laziness on your part to read the documentation, I only suggested that you take a bit more time, as it is needed to really understand the subject.
Maybe, after you have everything up and running, you can contribute some documentation that you seem to miss at the moment. That would be helpful. I've read the other threads too, but didn't find the time to formulate a helpful answer to your other questions. My thoughts about them until now are: 1) It is a good suggestion to first explore a better documented way to define OneToOne and OneToMany relations and then switching to PHP. That last step is probably very easy, even without any further documentation, once you have the more common way of doing it running. If documentation is not giving you any clues, then you can always look at the code itself for names of methods, expected arguments etc. It can also be helpful to keep this API-documentation at hand: http://www.doctrine-project.org/api/orm/2.2/ 2) My main thought seeing your native SQL queries was that I didn't see any need for them. I would do that using DQL, thereby querying the objects, not the tables. The native queries are merely a fallback for performance improvement for a specific database; when they are needed because you cannot express your query in DQL, then that might be an indication your model could be improved. Another advantage of DQL is too, that your model is not dependent on a specific database. So, I would say: try to accomplish what you want in DQL and save experiments with native queries for later, once you have a basic application up and running. 3) I use an eventlistener for user-defined table-prefixes in several applications without any problems, so I'll look up what I did and post it (once I find some time). My implementation was based on that same cookbook example. My only change was: I define #_ where the provided table-prefix should be replaced (as is generally practice in Joomla); in that way I can also use tables without a prefix or with a temporary hardcoded prefix, besides the tables with a prefix. I'll show you (but no time now). I didn't immediately understand your question and have to look at the code to figure out what you mean exactly, and that will take some time. Regards, *- Herman Peeren* On Tuesday, 4 February 2014 14:05:51 UTC+1, Parsifal wrote: > > Thank you my friend Hermann! > Actually I am not lazy reading docs. For doc1, Jon Wage wrote a very > excellent doc as PDF that I was able to figure out everything with no > questions in mailing-list. But for v2 more examples are with annotations. > Marco suggested to start with XML then switch for PHP. My answer to him is > that even I start wuth xml, then while switching to php, I did not find any > sample code in docs how I can implement OneToMany and OneToOne methods in > my StaticPHP entities. Can you provide such sample or the Guide is not much > complete or I was lazy to find it in docs? > I just have a few questions to get it running: 1) implementing > OneToOne/OneToMany things in PHP entities as all doc samples are for > annotation 2) getting NativeQuery to work as said in another email 3) in > another post I asked if I am guessing correct to call eventlistener within > entity to pass table prefix to it and I gave the doc link if that is thr > correct way? > در 2014 2 4 13:29، "Herman Peeren" <[email protected] <javascript:>> > نوشت: > >> No, there is no difference between entities and src. The tutorial docs >> you are referring to are building up the entities and mapping step by step: >> first it is the code of the entities, without the mapping. Later the >> mapping is added. When using annotation, the mapping is added to the same >> files in which the entities are defined. Please take some time to read the >> docs a few times, and then a few times more, until you really understand >> what it is saying. Then your questions will be resolved. >> >> Some basic vocabulary (you can read more about it in Martin Fowler's >> "Patterns of Enterprise Application Architecture" and Eric Evans' "Domain >> Driven Design" to get a better understanding of basic theory): >> >> - *entity *= a *domain-object* (defined by its identity). In general, >> these are the basic "things" to build your model with. >> - object relational mapping (ORM) = a *mapping *between the domain >> objects (entities) and relational database tables in order to be able to >> persist the state of those objects. >> >> There is no "src" in the basic vocabulary. That is just a folder that is >> used in the example to store the PHP-code. You can also use another folder >> for that; it's not important, just an example. In your program you work >> with the entities, the domain-objects. The mapping is a different layer, >> only used to define the storage of the properties you want to persist. For >> convenience the mapping can be in the same file as the definition of your >> entities (by means of annotation or as a static function with PHP), but it >> still is another layer. >> >> So please take 2 steps back and read the whole documentation. And again. >> And some times more. You will understand it if you take the time needed for >> it. Succes! >> >> *- Herman* >> On Tuesday, 4 February 2014 12:51:19 UTC+1, Parsifal wrote: >>> >>> I entity files are the files that are used for metadata and mapping. By >>> src I meant the files that are explained in the start of docs. I asked what >>> are the diff? Is actually /src for creating database schema and when DB is >>> created they will not be used anymore? >>> در 2014 2 4 11:57، "Sebastian Krebs" <[email protected]> نوشت: >>> >>>> Hi, >>>> >>>> I only speak for myself, but I have no idea, what you are talking >>>> about. What exactly do you mean with "src" and "entity"? >>>> >>>> >>>> 2014-02-04 Nima Sadjadi <[email protected]>: >>>> >>>>> I am confused of this. Please advice. >>>>> در 2014 2 3 17:03، "Nima Sadjadi" <[email protected]> نوشت: >>>>> >>>>> Just to make sure the difference of src and entity is that, src is for >>>>>> creating database structure and tables during instalation, but when db >>>>>> is >>>>>> created then src will no longer be used but just entities will be used >>>>>> to >>>>>> update/inaert/query records from db, am I correct? >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "doctrine-user" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at http://groups.google.com/group/doctrine-user. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>> >>>> >>>> >>>> -- >>>> github.com/KingCrunch >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "doctrine-user" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/doctrine-user. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "doctrine-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/doctrine-user. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/groups/opt_out.
