2

I need the command to generate a single entity from an existing database and I cannot get the command formatted correctly. I changed my setup to the DB in parameters.yml to look at the database in question and then I run:
php app/console doctrine:mapping:import AppBundle xml --filter="tbl_remote"

This keeps on complaining that some table that is not related to tbl_remote does not have a primary key. From the error message I can see that it is looking at the correct database but I need to create and entity for only one table.

From my understanding this will create an xml file and to get the entity I will run:
php app/console doctrine:generate:entities AppBundle:tbl_remote --path src/

Why will it not create the xml file?

1

2 Answers 2

3

After finding that the --filter does not do what I hoped, I scripted tbl_remote and created it in my test database. I then changed parameters.yml to look at the test database and after running: php app/console doctrine:mapping:import --filter="tbl_remote" AppBundle i was greeted with: "Database does not have any mapping information."

This is not my day so I just ran: php app/console doctrine:mapping:import AppBundle and removed the .orm.xml that I did not need.

I was then able to run: php app/console doctrine:generate:entities AppBundle to generate the single entity!! Not what I wanted but not a complete loss.

Sign up to request clarification or add additional context in comments.

Comments

0

to generate a single entity from the database I use this little sh script:

#!/bin/bash
clear;
echo "####################################################################################################"
echo "# Generating the Doctrine files for a given entity, be carefull that the entities are CamelCased". #"
echo "####################################################################################################"
date

# Testing arguments
EXPECTED_ARGS=1
E_BADARGS=65
if [ $# -ne $EXPECTED_ARGS ]
then
  echo "Usage: ./`basename $0` MyEntity"
  exit $E_BADARGS
fi

php app/console doctrine:mapping:import CoreBundle annotation --filter=$1
php app/console doctrine:generate:entities Project\\Bundle\\CoreBundle\\Entity\\$1
echo "  --> Done!"
date

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.