How to use extended properties with the Google Calendar php api - php

I have been struggling with the php api for Google Calendar for weeks now.
I have already managed to add and read events with the api and now I'm trying to get Extended Properies to work. I have tried two different ways of adding them to my events:
1:
$extProp = New Google_EventExtendedProperties('test', 'test');
$event->setExtendedProperty($extProps);
2:
$extProp = New Google_EventExtendedProperties('test', 'test');
$event->ExtendedProperty = $extProps;
Both don't give me errors, but I'm not sure if it's working. I tried to read the events with the get method as well as with the list method wich are both described in the documentation of the api, but I can't get my extended properties.
Does anyone know how extended properties work with php?

I finally managed to do it. I used the following code:
$extendedProperties = New Google_EventExtendedProperties();
$extendedProperties->setShared(array('custom'=>'blalblabla'));
$event->setExtendedProperties($extendedProperties);

$extendedProperties = New Google_EventExtendedProperties();
should be changed to:
$extendedProperties = new Google_Service_Calendar_EventExtendedProperties();

Related

Doctrine ORM not working with the Migrations

Good Day, my friends.
I want to use the doctrine ORM with the Migrations.
The issue is next: I want to place the migration configuration file in the specific folder. For example: 'config/doctrine-migrations.php'.
Everything working fine when I follow the official documentation and place the migrations.php file in the root folder, but when I try to place it in the specific folder system is not working.
My cli-config.php content is:
<?php
require_once "app/bootstrap.php";
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($container->get(\Doctrine\ORM\EntityManager::class));
Well, I can change this file in a next way:
<?php
require_once "app/bootstrap.php";
return \Doctrine\Migrations\DependencyFactory::fromEntityManager(
new \Doctrine\Migrations\Configuration\Migration\PhpFile(BP . '/config/doctrine-migrations.php'),
new \Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager($container->get(\Doctrine\ORM\EntityManager::class))
);
After this, Doctrine Migration working fine, but Doctrine ORM stop working with the next error:
Argument #1 ($helperSet) must be of type Symfony\Component\Console\Helper\HelperSet, Doctrine\Migrations\DependencyFactory given
If someone knows how to solve my issue and use a specific config file please clarify a possible solution.
Best Regards, Mavis.
I may be a bit late, but i ran into the same problem as you.
You can use the same cli-config for migrations and orm. For that, you need add
the orm commands manually to the cli-config.php.
My cli config looks like this:
$em = getEntityManager();
$config = new PhpFile('migrations.php');
$dependencyFactory = DependencyFactory::fromEntityManager($config, new ExistingEntityManager($em));
$migrationCommands = [
new Command\DumpSchemaCommand($dependencyFactory),
new Command\ExecuteCommand($dependencyFactory),
new Command\GenerateCommand($dependencyFactory),
new Command\LatestCommand($dependencyFactory),
new Command\ListCommand($dependencyFactory),
new Command\MigrateCommand($dependencyFactory),
new Command\RollupCommand($dependencyFactory),
new Command\StatusCommand($dependencyFactory),
new Command\SyncMetadataCommand($dependencyFactory),
new Command\VersionCommand($dependencyFactory),
];
$customCommands = [];
$commands = array_merge($migrationCommands, $customCommands);
ConsoleRunner::run(new SingleManagerProvider($em), $commands);
All my import statements, are not included in this example, but you can
get them from the docrtine documentation
Looks like I found an answer.
I can add custom integration in my application by this guide: https://www.doctrine-project.org/projects/doctrine-migrations/en/3.0/reference/custom-integration.html
In a custom file, I can configure whatever I want.
Hope that this solution will help somebody else.

Working with the latest PHP / MongoDB version

After much of a struggle I managed to install MongoDB as a service and WAMP. Then on start I got a fatal error saying these would not work:
$m = new Mongo(...);
$m = new MongoClient(...);
In some previous questions on SO people mentioned using a new class called MongoDB/Driver/Manager. I also came across something called MongoDB/Client.
As a beginner to MongoDB I now stand rather confused about how to use/connect to a DB and collection.
I guess I will use:
$m = new MongoDB/Driver/Manager(...);
However,
$db = $m->$dbname; // Seems to cause -> Notice: Undefined Property
$collection = $db->shows; // dito
So all in all what are the difference between MongoDB/Driver/Manager and MongoDB/Client ? And with these new classes how would I correctly connect to a DB or Collection as shown in the previous snippet ? I can't seem to find many examples explaining how to use these new classes, or an up to date correct way of using the new classes for basic functionality.
Thanks,
I think I understand what I am confusing.
Using the MongoDB/Driver/Manager class and others, are part of the basic tools available with the PHP MongoDB Driver. I am guessing it is not recommended using them unless you know what you are doing, or you want something relatively customized.
A more recommendable alternative is to install "mongodb/mongodb-^1.x.x" with a PHP installer such as Composer, which will give you a MongoDB Library. This will give you classes such as the MongoDB/Client class.
Once the library has been installed you can connect like so:
<?php
require 'vendor/autoload.php';
$client = new MongoDB/Client('mongodb://localhost:27017');
// Add URI of MongoDB here
$mydb = $client->mydb; // Add the new DB name or existing DB name here
$collection = $mydb->createCollection('userCollection');
...
?>

PHP / NetSuite - nsComplexObject Doesn't Exist

I am not certain if I am maybe misunderstanding, something in the examples I see, but any time I try to make sure of nsComplexObject, I get an error that it does not exist.
I am specifically trying to create a sales order. I set up my array of values, but when I try to do the following, I get an error:
<?php
require_once '../PHPToolkit/NetSuiteService.php';
$service = new NetSuiteService();
$salesOrder = new nsComplexObject('SalesOrder');
?>
I think you're looking at older Toolkit examples.
The newer versions (I think since 2012_2) use a different method for instantiating objects, such as:
$salesOrder = new SalesOrder();
You can still use the setFields method to populate object properties, but you can also populate them directly now:
$salesOrder->entity = $someRecordRefObject;

updating status in jira via php

im using a email client that i build to update jira tasks. i have managed to change the assignee and the summary through it. but i cannot seems to find a way to update the status. following is the code i used.
$resolution->id="4";
$update->transitions= array($resolution);
$queryIssue = new Jira($config);
$queryIssue->updateTransition($query,$update);
the class:
public function updateTransition($issueKey,$json){
$this->request->openConnect('https://'.$this->host.'/rest/api/latest/issue/REC-143/transitions?', 'POST', $json);
$this->request->execute();
}
this gives me an error saying
Missing 'transition' identifier
what am i doing wrong here.please let me know.
the way i input the json was incorrect.it should be,
$resolution->transition->id ="4";
$queryIssue->updateTransition('11205',$resolution);
like this. and by the way i used this library to do all my needs with jira. the things which are not included here, i had to implement by my self. which is easy if you know the api urls.take a look at the rest api documentation for the suitable apis you may require.

Zend Gdata - setVisibility for newEventEntry? (specify events for multiple calendars)

I know that you can use setVisibility('private-abcdefg') for newEventQuery() in order to specify a particular calendar.
My question is, can I use the same concept for newEventEntry()?
$gdataCal = new Zend_Gdata_Calendar($client);
$newEvent = $gdataCal->newEventEntry();
$newEvent->setVisibility('private-******************');
I tried out this code, but I receive the error:
Fatal error: Call to a member function getDOM() on a non-object in /home/content/b/e/h/behrk2/html/ZendGdata-1.8.4PL1/library/Zend/Gdata/Kind/EventEntry.php on line 154
Is there anything I can do to accomplish this? Because I have multiple Google Calendar's in one account, and I would like to specify which Calendar an event should go to...
Thanks!
You're overthinking it. I had the same exact problem, and it's simple, but not obvious, and took me some digging through the documentation to notice. To post to a calendar other than the default calendar, just add the uri to the other calendar to the insertEvent function at the end, like so:
$createdEvent = $gdataCal->insertEvent($newEvent, $uri);

Categories