doctrine1 icon indicating copy to clipboard operation
doctrine1 copied to clipboard

PHP Notices showing up when trying to build schema yaml from db

Open codeguruvp opened this issue 8 years ago • 5 comments

Hi,

I am getting the following PHP Notice multiple times when trying to build schema from db

PHP Notice: Undefined index: type in /workspace/virtual_hosts/Daily/lib/vendor/lexpress/doctrine1/lib/Doctrine/Import/Builder.php on line 785

Here's symfony command I'm using: ./symfony doctrine:build-schema

I'm on PHP 7.1.1 running lexpress (Symfony 1.5.7 and Doctrine1-dev-master)

codeguruvp avatar Feb 07 '17 04:02 codeguruvp

Feel free to provide a PR to fix that notice. We didn't test doctrine1 over PHP 7.1.1

j0k3r avatar Feb 07 '17 07:02 j0k3r

It seems it's related to https://github.com/FriendsOfSymfony1/doctrine1/pull/64

desyncr avatar Dec 20 '18 04:12 desyncr

Hello @codeguruvp

As the PR #64 is already in progress but it still miss a test case.

Feel free to help @desyncr to add a test case or at least to isolate the bug with the minimum of data fixtures.


We didn't test doctrine1 over PHP 7.1.1

@j0k3r I do not think so, as I ran tests with PHP 7.1 [ref]. Then is more about a missing test for this case.

alquerci avatar Dec 21 '18 02:12 alquerci

Hi @alquerci I am no longer involved in any active symfony 1.4 based projects any longer. So I do not have dev environment with that config that I can test right away. Therefore, unfortunately, I am not in a position to contribute right now. From what I remember, the issue was trivial as it was just a missing index warning that I was receiving while performing.

./symfony doctrine:build-schema

I was able to suppress it by simply checking whether the the variable was actually set and that basically worked for me for what I needed.

Changing (in lexpress/doctrine1/lib/Doctrine/Import/Builder.php )

 if ($relation["type"] == Doctrine_Relation::ONE) 

to

 if (isset($relation["type"]) && $relation["type"] == Doctrine_Relation::ONE) 

In terms of reproducing it, this can be done with a minimal set of data in the database and running the above command. All the command does is build/rebuild the schema for you. The warning should show during the execution. Sorry if I am not of more help to you guys. Thank you

codeguruvp avatar Dec 21 '18 04:12 codeguruvp

@codeguruvp you took time to write this issue, thank you. And the info that it can be reproduced with a minimal set of data in the database, it's already a good help.

alquerci avatar Dec 21 '18 15:12 alquerci