I am using Doctrine 2, and a MySQL back end. I am running a CLI command to analyze the the schema and produce YML files. I am using the following CLI command.
php ./doctrine.php orm:convert-mapping --verbose --force --from-database yml tmp_yaml
I then do some processing on the YAML files, and then have Doctrine create entity files from them. However, we need the entities to be in a particular namespace. Right now I just process the resulting entity .php files, but that is a really bad way to do it.
How can I have Doctrine create YAML's with our namespace. If that is not possible, how can I have Doctrine create entities that are in our namespace?
Thanks!!! -Don!
In the docs they say to name the YAML file and the root element with the full name of the entity class, including the namespace (separated by . instead of \)
Be aware that class-names specified in the YAML files should be fully qualified.
That should be it.
Related
I'm creating an npm package which contains a schema file, set.schema.json. I'm wondering how I can set this as the $schema of a JSON file in another project with this package installed as a dependency. I'm mainly using the schema for IDE suggestions, rather than validation.
JSON Schema does not specify a way to do this.
Any way you want to do this needs to be supported by the IDE in question.
I'm using Google Cloud Deployment and I am trying to get external input into my template. Namely, I want to set a metadata variable on my instance (when creating the instance) but provide this value on execution.
I've tried:
gcloud deployment-manager deployments create test-api-backend --config test-api-backend.yaml --properties 'my_value=hello'
Which fails (The properties flag should only be used when passing in a template as your config file.)
I've tried:
my_value=hello gcloud deployment-manager deployments create test-api-backend --config test-api-backend.yaml
And use {{env['my_value']}} but the value isn't picked up.
I guess I could add the property in a .jinja file and re-write this file before I run everything, but it feels like a hack. That, or my idea of passing a variable from shell into Deploy Manager is a hack. I'm honestly not sure.
As the error message indicates, the command line properties can only be used with a template. They are essentially meant to replace the config yaml file.
The easiest thing to do is to just rename your yaml file to a .py or .jinja file. Then use that template as the file in the gcloud command instead of the yaml file.
In that new template file, add any defaults you would like if you don't pass them in on the command line.
For python, something like:
if 'myparam' in context.properties:
valuetouse = context.properities['myparam']
else:
valuetouse = mydefaultvalue
If the template uses another template then you'll also need to create a schema file for the new, top level template so you can do the imports there instead of the yaml file.
See the schema file in this github example.
https://github.com/GoogleCloudPlatform/deploymentmanager-samples/blob/master/examples/v2/igm-updater/ha-service.py.schema
If you want, you can ignore all the properties and just do the imports section.
For my dev workflow purposes, I'd like to create a new orientdb database given a JSON schema, on the fly. I dont believe this is natively supported in orientdb, are there any existing solutions that do this - provide a JSON schema and point to a orientdb instance, and it auto-creates the database (edges, vertices, indexes and perhaps some sample data).
I ended up creating a .sh script to create the DB on the fly. The .sh files looks something like:
# (file: createmydb.sh)
# script to create my database declaratively
set echo true
# use this to ignore errors and continue, if needed
# set ignoreErrors true
# create database
create database plocal:../databases/MyDB root root plocal graph
# create User vertex
create class User extends V
create property User.Email STRING
create property User.Firstname STRING
...
And then call it like:
/usr/local/src/orientdb/bin/console.sh createmydb.sh
This works well for my purposes. The DB creation script is very easy to read, can be modified easily. And I am sure very backwards compatible (which may not have been the case with importing an exported JSON version of the db schema).
So far I've found that pre-loading the schema using an external definition stored in either JSON or OSQL has been most successful for me. Currently I am using an OSQL script that contains a whole bunch of CREATE CLASS ... and CREATE PROPERTY ... commands. It works well enough.
Pretty soon I'll have to start supporting dynamic changes to the data model, at which point I will have to write code to read a JSON schema definition and convert that to appropriate calls into OrientDB, either through the Blueprints API or through SQL batches.
I've not found a tool that does what you need "automatically." If you find one, please let me (and everyone else here) know.
My configuration generated by eb init contains the following:
[aws:autoscaling:asg]
Custom Availability Zones=
MaxSize=2
MinSize=1
How can I specify to use a different scaling trigger in the optionsettings file?
Can I perhaps use some approach through .ebextensions?
I would recommend using ebextensions for this usecase as that will give you more flexibility in the manner you deploy your code. Read about possible option setting values here.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html
Create a .ebextensions directory in your app source. Create a file with .config extension in this directory. Use the aws:autoscaling:trigger namespace. The file should have YAML syntax.
Example Contents:
option_settings:
- namespace: aws:autoscaling:trigger
option_name: BreachDuration
value: 300
The files in the ebextensions directory are processed in alphabetical order.
More information on ebextensions here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
I generated a bundle and set it to use annotations for config files. But I find that in Resources/config/services.xml, its still XML? Perhaps it because I cant configure services using annotations? If so how can I make it use yml if thats the case? I could just add a YML file but I dont suppose it will be detected?
Your assumption that you can't define a service using Annotations is correct. You need to have either a services.xml or services.yml under Resources/config for the bundle.
Check out the answers to this question, it covers how to define a service using both xml, yml and through a config.yml import.
I've also written an answer here on the basics of defining a service.