26

Re: ZC38 – Introducing Doctrine 1.2 Integration

The developers working on Doctrine apparently have a fix for this using packages and PEAR-style autoloading. I'm going to try and touch on this in the next Doctrine video.

27

Re: ZC38 – Introducing Doctrine 1.2 Integration

Hi Jon,

I've gotten 1.2.1 to work, however it doesn't work fully. When I run ./doctrine build-all-reload it drops the database fine. After that it quits and I get the error:

PHP Fatal error:  Uncaught exception 'Doctrine_Connection_Exception' with message 'PDO Connection Error: SQLSTATE[42000] [1049] Unknown database 'more_twit'' in /home/more/library/Doctrine/Connection.php:474

I have the user's permissions set so it can create the database but through the cli it fails or checks to see if the database exists. Failing that it blows up. What am I doing wrong?

Jamie

28

Re: ZC38 – Introducing Doctrine 1.2 Integration

Check  the enivronment (production/development ) in application.ini

29

Re: ZC38 – Introducing Doctrine 1.2 Integration

I'm using Doctrine 1.2.1 and I have a pretty weird problem with the doctrine CLI module (in the scripts folder).
After calling './doctrine build-all-reload' I get asked: Are you sure you wish to drop your databases? (y/n), I answer with 'y'. Well,l the dropping of the database works as expected -but sadly the YAML file (exactly like the tutorial one) is not being interpreted, nor do I get an error message. Needles to say that nothing is written to the database. Any Ideas?

Thanks in advance !

P

30

Re: ZC38 – Introducing Doctrine 1.2 Integration

Hi everywhere, quick question for all of you: There is a hack/solution to use schemas in PostgreSQL/Oracle? I mean, in the database there is the 'public' and 'enterprise' .. I want to work with them. Is there any support for this concept? (Hibernate supports it wit annotations...).

31

Re: ZC38 – Introducing Doctrine 1.2 Integration

n8m wrote:

I'm using Doctrine 1.2.1 and I have a pretty weird problem with the doctrine CLI module (in the scripts folder).
After calling './doctrine build-all-reload' I get asked: Are you sure you wish to drop your databases? (y/n), I answer with 'y'. Well,l the dropping of the database works as expected -but sadly the YAML file (exactly like the tutorial one) is not being interpreted, nor do I get an error message. Needles to say that nothing is written to the database. Any Ideas?

Thanks in advance !

P

I was having problems impleting this episode in windows 7. Well I've found the solution in this page which covers windows and *nix.

http://blog.hackix.com/2010/01/setting- … ork-1-9-x/

I got it working on windows.Try it.

32

Re: ZC38 – Introducing Doctrine 1.2 Integration

Did anybody manage use Doctrine extensions with this setup?

My Doctrine installation works ok, but I can not regsiter extensions. I have looked at the Doctrine documentation, but everything I have tried does not work and I haven't found a single tutorial on the web explaining how to register extensions with Doctrine when using it with ZF.

33

Re: ZC38 – Introducing Doctrine 1.2 Integration

Hi,

in my yaml file i have to say "VARCHAR" instead of "string" since it (Doctrine Cli) does generate a Create query where it uses String and MySQL doesn't know what to do with that and just says "Syntax Error".

Why does that work in your case and not in mine? I was using Doctrine 1.2.2, but tryed 1.2.0 as well. My Zend Installation is almost the same as yours but version 1.10.7.

Anyone any Ideas or similiar problems?

34

Re: ZC38 – Introducing Doctrine 1.2 Integration

hi... i'm still new with using PHP framework and i don't understand the use of using Doctrine to handle database connection. Could you elaborate the main reasons why one project needs to use doctrine ? Actually I'm looking for a solution to handle large database items. Could doctrine speed things up when dealing with hundreds of million records (such as Facebook databases)?
If yes, maybe you could discuss on how to set up doctrine to handle large databases in the next videocast. And if no, maybe you could talk about what other solutions there are to handle such large databases.

Also, it's a great tutorial you have here and i learn a lot about using framework from it.. many thanks

35

Re: ZC38 – Introducing Doctrine 1.2 Integration

Hi Tamara,

Doctrine excels at handling the join operations between tables. If you have million+ record tables, an ORM won't help you with performance. Doctrine 2 is more performant and utilizes patterns that will help you cache queries and manage transactions efficiently and so I'd suggest looking at that over Doctrine 1.2.

I would also suggest looking at stored procedures as a way of handling this. Also, if you have large recordset tables, there might be ways of partitioning or indexing your dataset so it's better accessed. Can you provide any more details about the type of requests you're making on the data?

36

Re: ZC38 – Introducing Doctrine 1.2 Integration

gog wrote:

Did anybody manage use Doctrine extensions with this setup?

My Doctrine installation works ok, but I can not regsiter extensions. I have looked at the Doctrine documentation, but everything I have tried does not work and I haven't found a single tutorial on the web explaining how to register extensions with Doctrine when using it with ZF.

Had the same problem something to do with the ZF autoloader.

The hack is to drop the files from the extension into the Doctrine/Template and Doctrine/Template/Listener folders and then ZF can load them.   You do not even have to register the extension in the bootstrap.  You will have to repeat this if you update Doctrine though.

Got the Blameable extension working well, although it did need a few tweaks.  There is an issue with loading the database if you are  using the relations element.

Regards

Tim

37

Re: ZC38 – Introducing Doctrine 1.2 Integration

OK Here's one for you.

This is copied directly from Terminal in Mac OS:

Jakes-MacBook-Pro:scripts Jake$ ./doctrine build-all-reload
build-all-reload - Are you sure you wish to drop your databases? (y/n)
y
build-all-reload - Couldn't locate driver named mysql
build-all-reload - Couldn't locate driver named mysql

I understand there is a native PHP instance running on the MAC. So I redirected php to my MAMP installation in my doctrine file. When I do this I get:

env: /Applications/MAMP/bin/php5.3/bin/php: Permission denied

So, when that didn't work I tried using an alias in .bashrc in order to direct PHP to my MAMP installation. I did the following:

alias php='/Applications/MAMP/bin/php5.3/bin/php'

after doing

$source .bashrc

I ran the ./doctrine build-all-reload again and got:

Jakes-MacBook-Pro:scripts Jake$ ./doctrine build-all-reload
build-all-reload - Are you sure you wish to drop your databases? (y/n)
y
build-all-reload - Couldn't locate driver named mysql
build-all-reload - Couldn't locate driver named mysql

I'm completely baffled. Anyone have any suggestions for what I should try next?

Thanks in advance...

P.S. BTW, the pdo_mysql extension IS enabled. I checked php.ini myself.

Last edited by Fivelow (2010-08-01 22:01:43)

38

Re: ZC38 – Introducing Doctrine 1.2 Integration

@Fivelow - not sure if you're still experiencing this problem, but I found that the reason the permission denied problem is coming up when trying to use the MAMP install of php is because for some reason, the permissions aren't set to execute by default (I had the same problem).

Just run chmod 774 /Applications/MAMP/bin/php5.3/bin/php from terminal and then try the original script again

39

Re: ZC38 – Introducing Doctrine 1.2 Integration

I ran the chmod that RobJ suggested and now when I run ./doctrine build-all-reload I get...

nothing

The prompt just comes back like it ran something but no feedback from doctrine of any kind. This is rapidly becoming more trouble than it's worth.