Drupal/Drush: How to bundle a project.profile within a project.make? - drupal

Is there any way to do:
files["project.profile"][subdir] = "profiles/project"
so I get packed the installation profile on the final bundle?

This is a great page about Profiles and Drush make.
http://drupal.org/node/642116
Currently experimenting with this myself.

Related

How to add new column to exitsting table symfony - orocommerce

I'm working on an orocommerce project, and it use vendor/oro/bundles/bundle_name
And in that bundle, it have an entity named "oro_customer_user", so i want to add a new column in that table using my new bundles.
I've searched a lot but still no luck.
Almost of solution say i need to fix in vendor/oro/bundles/bundle_name, which i don't want to do.
But still have some solution say i need to use DoctrineMigrationsBundle but i'm not sure about this.
https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
Please give advice, thanks :)
Alright, so i've found the solution for orocommerce
Just use Migration and everything is gonna be fine
You can check in this link:
https://forum.oroinc.com/orocrm/orocrm-programming-questions/topic/add-custom-field-into-orocrm-entity#post-24765
The migrate you have to create manual, because i don't know how to create migrate by command line :( .
After create migrate done, you only need to run this cmd:
php app/console oro:migration:load --show-queries
Now go and check in database, its done already.
And about entity:
I still don't know how to custom it in orocommerce. It got a lot of error.

Nelmio/Alice 2.x Symfony 3 , Loading Related Fixtures in Different Bundles

If there's already answer to my question then sorry and please point me in the right direction because I can't find anything.
Let's say I have two Bundles. Each bundle has fixures.yml file and loader file.
Loaders and fixtures are working fine when they are not depending on each other.
However when I am referencing fixtureA from fixtureB I get duplicated record in database.
E.g:
user_{1..10}:
email (unique): '<firstName()>+<randomNumber()>#gmail.com'
plainPassword: 'secret'
story_{1..10}:
user: "#user_<current()>"
title: '<word>'
When they are in separated files - duplicated row. When they are in the same file everything is ok.
Why it's being loaded twice?
I even tried this:
$objects = Fixtures::load(__DIR__ . '/fixtures.yml', $manager, ['persist_once'=>true]);
No luck.
Evey time I am trying to use user object in story fixtures alice tries to save it into db again.
Best Regards,
Robert
I did a little research and talked to people - it looks like it's a possible bug. You can learn more here:
Nelmio/Alice 2.x Duplicated Row
Also I would like to share my work around:
I wanted to keep things separated and clean. Instead of keeping all fixtures in one file in one bundle you can move it to App/DataFixtures/ORM directory. However Symfony will not look for fixtures in this directory. You can:
add path to the fixtures in console command:
doctrine:fixtures:load --fixtures=/var/www/story/app/DataFixtures/ORM
create alias for above solution
override DoctrineFixturesBundle - how to do this
I hope this will help if you have similar issue.

Active Model Serializer not render my models

I am trying to integrate Active Model Serializer to render JSON elements with relations.
I follow the documentation on this address: http://rubydoc.info/gems/active_model_serializers
I am not sure if I am doing something wrong but it looks like serializers are not working. Do I need to make more steps?
I install the gem, generate the serializer and add relation.
Can you guide me, please??
My project is in this repo:
https://github.com/dwdsolutions/argo
Best Regards
You're using the 0.9.0 version. Try to change it to 0.8.0
Alex is right, I tried using v0.9.0 earlier and was unable to get it working per the existing documentation.
The main github repo does state to use v0.8.0 if you are familiar with the gem (https://github.com/rails-api/active_model_serializers/tree/master#maintenance-please-read). At any rate, once you get it working, you shouldn't need to manually specify your serializers since they're named properly compared to your models and controllers.
i.e. you can remove the trailing option of this line:
render json: #travel, serializer: TravelSerializer
And make it just:
render json: #travel

How to run Openstack-Swift java api?

I try to run Openstack-Swift java sdk sample.
I have swift and keystone project to use swift only.
I found this project : https://github.com/woorea/openstack-java-sdk
But, I don't know how to run this project in Window Eclipse.
Should I build all project(nova, etc..) in maven?
Do you know how to run this project or website that post run-way in regular sequence?
#stream
I have not tried Woorea but i know a lot many developers are using Jclouds, the link http://developer.rackspace.com/#home-sdks has well documented guide with example how to use the Java SDK.
Hope it helps.
looks like you can build SWIFT independently (part of woorea peoject)
as it states in the readme file here:
(com.woorea swift-client 3.0.0-SNAPSHOT)
https://github.com/woorea/openstack-java-sdk
the Maven artifact ID should be:
openstack-java-sdk
Here is a nice toturial that can be of hand:
https://github.com/woorea/openstack-java-sdk/wiki/Swift-Tutorial
it has the example for the java api for using SWIFT,
for example, this code snippet (more details in the link):
Properties properties = System.getProperties();
properties.put("verbose", "true");
properties.put("auth.credentials", "passwordCredentials");
properties.put("auth.username", "demo");
properties.put("auth.password", "secret0");
properties.put("auth.tenantName", "demo");
properties.put("identity.endpoint.publicURL","http://192.168.1.43:5000/v2.0");
OpenStackClient openstack = OpenStackClient.authenticate(properties);
AccountResource account = openstack.getStorageEndpoint();
account.container("hellocontainer").put();
account.container("hellocontainer").object("dir1").put();
account.container("hellocontainer").object("test1")
.put(new File("pom.xml"), new SwiftStorageObjectProperties() {{
setContentType("application/xml");
getCustomProperties().putAll(new HashMap<String, String>() {{
put("customkey.1", "customvalue.1");
}});
}});
List<SwiftStorageObject> objects = account.container("hellocontainer").get();
just keep in mind that when using openstack's API you will most likely need to authenticate (get tokens etc..) so that you will need the Keystone lib as well
www.programcreek.com/java-api-examples/index.php?api=com.woorea.openstack.keystone.Keystone
hope this helps.

How to use the decoupled symfony components?

Any information on how to use symfony's decoupled components?
I'm rereading the docs but there's nothing on the topic besides a general message of "They are very very decoupled" and 1 tutorial that makes use of Request and Response.
There's also one badly ranked answer of Using symfony2 routing component (outside of symfony2)
Also having a look at a tutorial for the standalone Form component doesn't actually excite me how pleasant this is.
I need the routing, yaml, and session.
The first component you should use is ClassLoader. You can also use spl_autoload_register, but you're using Symfony, so why shouldn't you use its own autoloading library? Add the following at the top of the script:
use Symfony\Component\ClassLoader\UniversalClassLoader;
require_once '/path/to/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$loader = new UniversalClassLoader();
$loader->register();
$loader->registerNamespaces(array(
'Symfony' => '/path/to/symfony/src',
));
Using the Yaml component is really easy:
use Symfony\Component\Yaml\Parser;
$data = Parser::parse('yaml string');
For the other components, you'll have to read the API documentation, as there are no tutorials yet.
Interestingly, Fabien Potencier just published a blog post which contains snippets of how to use the most common components. See the second half of this post for details.
I've written a tutorial which might help you, on using decoupled Symfony components in your project.
It shows how to use the console component as an example, but the logic is the same for other components.
Composer is the answer.
This video here http://www.youtube.com/watch?v=QOldVDVYnAE has a simple and straight forward step by step that answers your question.
EDIT on august 26th 2020: The video creator has made it private. Sorry, nothing I can do about it.
Symfony2 example
1) Install the component You need with composer in new folder
composer require symfony/yaml
2) Create the script yaml.php
<?php
require_once __DIR__.'/vendor/autoload.php';
use Symfony\Component\Yaml\Parser;
$yaml = new Parser();
$value = $yaml->parse('invoice: 3484');
var_dump($value);
3) Run the script
php yaml.php

Resources