Reference:
Heading "Entities Settings" on the link below
https://github.com/doctrine/DoctrineORMModule#entities-settings
tells to register configurations on module (merged) configuration. However in order to use doctrine from more than one modules, if i use same configuration keys like ;
'paths' => [
'path/to/my/entities',
'another/path',
],
'orm_default' => [
'drivers' => [
// ...
will not the other module overwrite the array as values of keys? (yielding the effect as only last module configured to use ORM / Entities).
If the answer is yes then should not we define the configuration in autoload/global.php ?
No, configuration of all modules in ZF is “losslessly” merged, not overwritten by the last one.
For example, if you put the following in TheFirstModule’s config:
'paths' => [__DIR__ . '/../src/Entity/']
and the following in TheSecondModule’s config:
'paths' => [__DIR__ . '/../src/Entity/']
the merged configuration will look like this:
'paths' => [
'…/module/TheFirstModule/src/Entity/',
'…/module/TheSecondModule/src/Entity/'
]
Related
I'm trying to create a plugin that adds an "invite" post type that has an "rewrite" param to prepend "convite" before post slug... The code looks like this:
register_post_type("invite_company", [
'label' => __("Empresas", "modaladvisorsplugin"),
'public' => true,
'supports' => ['title'],
'exclude_from_search' => false,
'show_in_rest' => false,
'rewrite' => [
'slug' => "convite",
],
'menu_icon' => "dashicons-building",
]);
At this point, all works fine. Next step is to add an rewrite rule to append anything after the post slug, that will be used in template as a query var... So, for example, this url:
site.com/convite/company/abcdefg
Must recognize abcdefg as a advisor query parameter. For this, I've tried this way:
register_post_type("invite_company", [
'label' => __("Empresas", "modaladvisorsplugin"),
'public' => true,
'supports' => ['title'],
'exclude_from_search' => false,
'show_in_rest' => false,
'rewrite' => [
'slug' => "convite",
],
'menu_icon' => "dashicons-building",
]);
public function rewrite_rules()
{
add_rewrite_rule(
"convite/([a-z0-9-]+)[/]?$",
"index.php?post_type=invite_company&advisor=\$matches[1]",
"top"
);
}
And filtering query_vars as follow:
public function query_vars($vars)
{
$vars[] = "advisor";
return $vars;
}
Sometime (I don't remember what was in regex), when I tried to access /convite/some-post-slug/abcde, the URL was rewritten to /convite/some-post-slug (excluding the appended segment).
By the way, isn't working... I think is a regex problem (maybe convite/([a-z0-9-]+)[/]?$ isn't what I need), but really I don't know what I'm doing wrong, and I'm not an expert in regex...
Can anyone help me?
I'm not sure if I'm fully understanding the requirements, but this might work better. The regex is a bit easier this way, and it should check for both company by itself as well as company with advisor.
add_rewrite_rule('convite/([^/]+)/([^/]+)/?', 'index.php?invite_company=$matches[1]&advisor=$matches[2]', 'top');
add_rewrite_rule('convite/([^/]+)/?$', 'index.php?invite_company=$matches[1]', 'top');
Also, remember to flush rewrite rules before testing (resave permalinks, or run flush_rewrite_rules(); in your code while testing).
wondered if someone could help.
I am using the PHP AWS SDK, v3 (just updated to latest), it's working as it should, can send MP3, returns a json file with transcription.
However, I want to use Content Redaction, but no matter what I try I can't see to get it to work, I don't get any errors, my code looks like this:
$transcribe->startTranscriptionJob([
'ContentRedaction' => [
'RedactionType' => 'PII',
'RedactionOutput' => 'redacted'
],
'LanguageCode' => 'lang',
'Media' => [
'MediaFileUri' => 'someurl',
],
'MediaFormat' => 'file',
'OutputBucketName' => 'bucket_name',
'Settings' => [
'ChannelIdentification' => true,
'SplitChannelTranscription' => true,
],
'TranscriptionJobName' => 'output_filename'
]);
I don't get any errors, it just transcribes it without the Content Redaction.
From their docs:
"To enable content redaction using the API, complete the request parameters of the ContentRedaction object in the StartTranscriptionJob operation. See the request syntax for the StartTranscriptionJob action for more information. To see if content redaction has been enabled for a particular transcription job, use GetTranscriptionJob. To see which jobs have content redaction enabled, use ListTranscriptionJobs."
I have deployed a Yii2 based app onto AWS Elastic Beanstalk, also I have created the RDS instance with a database (it already has tables) on Elastic Beanstalk. However I received this error: "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known"
All the files are uploaded correctly to the AWS instance.
The file /common/config/main-local.php has:
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=',
'dsn' => 'mysql:host=RDS_HOSTNAME:RDS_PORT;dbname=RDS_DB_NAME',
'username' => 'RDS_USERNAME',
'password' => 'RDS_PASSWORD',
'charset' => 'utf8',
],
What could be wrong? Thanks.
I am guessing that you want pass db information through environment variables. You may want to try to revise the code as below.
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=',
'dsn' => 'mysql:host='.$_SERVER['RDS_HOSTNAME'].':'.$_SERVER['RDS_PORT'].';dbname='.$_SERVER['RDS_DB_NAME'],
'username' => $_SERVER['RDS_USERNAME'],
'password' => $_SERVER['RDS_PASSWORD'],
'charset' => 'utf8',
],
You can reference http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.RDS.html#rds-external-ec2classic in To configure environment properties section to configure your environment variables. Hope this works.
You have 2 times your 'dsn' line and maybe the first one survives, so changing your config to this should work:
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=RDS_HOSTNAME:RDS_PORT;dbname=RDS_DB_NAME',
'username' => 'RDS_USERNAME',
'password' => 'RDS_PASSWORD',
'charset' => 'utf8',
],
(In addition I hope you are aware that you have to change RDS_* parameters :D)
I'm following the How to Configure SimpleSAMLphp for Drupal 8 on Acquia instruction. I'm at the bottom where it says, "SimpleSAMLphp_auth module settings. I personally recommend to store configuration for SimpleSAMLphp_auth module settings in settings.php." Once I copied the code he has in that code snippet to my settings.php file (pasted it at the bottom) and push it to Acquia, I got this error when I tried to login via the dev.mysite.com/user url.
The website encountered an unexpected error. Please try again later. Recoverable fatal error: Object of class Drupal\Core\Link could not be converted to string in Drupal\Component\Utility\Xss::filter() (line 67 of core/lib/Drupal/Component/Utility/Xss.php).
The code shown below is what I have in my settings.php file.
$config['simplesamlphp_auth.settings'] = [
// Basic settings.
'activate' => TRUE, // Enable or Disable SAML login.
'auth_source' => 'default-sp',
'login_link_display_name' => 'Login with your SSO account',
'register_users' => TRUE,
'debug' => FALSE,
// Local authentication.
'allow' => [
'default_login' => TRUE,
'set_drupal_pwd' => TRUE,
'default_login_users' => '',
'default_login_roles' => [
'authenticated' => FALSE,
'administrator' => 'administrator',
],
],
'logout_goto_url' => '',
// User info and syncing.
// `unique_id` is specified in Transient format, otherwise this should be `UPN`
// Please talk to your SSO adminsitrators about which format you should be using.
'unique_id' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn',
'user_name' => 'uid',
'mail_attr' => 'mail',
'sync' => [
'mail' => FALSE,
'user_name' => FALSE,
],
];
If I commented out this whole block of code in my setings.php file then I can login to my dev.mysite.com/user drupal site. One other thing I'm not clear is, do I "Check Activate authentication via SimpleSAMLphp option" first then copied the code snippet to my settings.php file and push to Acquia or the other way around?
Any help is much appreciated.
It seems that update to version 8.x-3.0-rc2 resolves the error above. However, looks like it introduces another issues, "This site can't be reached" and redirected the site to port 80 instead.
I have several modules in my zf2 application, they all have their own entities and all on the same connection.
A little diagram to explain the situation :
-Module 1
-Entity A
-Entity B
-Module 2
-Entity C
-Entity B
(all on the same database connection)
The problem is all the entities are working, i can fetch, update them, etc. but some are "invisible". I have some cross-module relations and they are working fine too.
For exemple, all entities from module 2 does not appear when I use the php public/index.php orm:info command nor in the Zend Developer Toolbar.
When I edit an entity, I have to manually update the database as php public/index.php orm:schema-tool:update says Nothing to update - your database is already in sync with the current entity metadata.
The entities can be fetched, they are just not "seen" by the ZDT nor the terminal, I don't know what I did wrong.
Thanks for your help
This is often caused when the path to the entities has not been declared in your config:
<?php
return array(
'doctrine' => array(
'driver' => array(
// defines an annotation driver with two paths, and names it `my_annotation_driver`
'my_annotation_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(
'path/to/my/entities',
'another/path'
),
),
// default metadata driver, aggregates all other drivers into a single one.
// Override `orm_default` only if you know what you're doing
'orm_default' => array(
'drivers' => array(
// register `my_annotation_driver` for any entity under namespace `My\Namespace`
'My\Namespace' => 'my_annotation_driver'
)
)
)
)
);