We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [services]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
133 views

Migrating Server - Craft isn't installed yet

I've set up a new Forge server and connected the repo to my site. I've also uploaded the database and copied over the db credentials to the dotenv file. However when I visit the site control panel ...
1
vote
1answer
171 views

Craft 3: how to call methods in another plugin's service?

In Craft 2, we used to be able to do so by doing: craft()->plugin1->myMethod(); from Plugin 2's service for example. Now in Craft 3, I couldn't figure out a way to do it. Plugin1::$plugin-&...
1
vote
1answer
447 views

Install Zoho CRM SDK (or any SDK for that matter)

For a client I need to connect a rather complex contact form with the Zoho CRM. They're offering a PHP SDK which sounds great, but I can't get it to work. It's very likely that I'm just stupid, ...
1
vote
1answer
140 views

“Unknown ”craft“ function” Error in Plugin Service Call

I'm just starting with plugins and I've downloaded the Business Logic plugin and am trying to call it from my template. Here's the code in my template: {% extends "_layout" %} {% block content %} ...
1
vote
0answers
334 views

Unable to call a service method from controller in my custom plugin

I know there are similar questions here, but I don't see a definitive answer, nor one that works for me. I've generated a plugin via pluginfactory.io, which has some controllers and a single service. ...
1
vote
1answer
40 views

Craft plugin services in subfolders

So I'm getting to a point where I have a lot of services in a particular plugin, and I would like to organize my plugin services into sub-folders. I've tried a couple ways but the controllers don't ...
2
votes
1answer
431 views

Craft 3: How to get Volume by handle?

How can I get the details of an asset volume in Craft 3, if I only know the handle? I found the Volumes and the Assets service, but I believe none of them provides a method for that purpose. The only ...
1
vote
1answer
65 views

Changing asset of entry's assetfield via entries.onBeforeSaveEntry

I'm trying to add an asset to an entry's assetfield when the entry is saved by using the onBeforeSaveEntry service provided by Craft. craft()->on('entries.onBeforeSaveEntry', function(Event $event)...
3
votes
1answer
92 views

Tech Support-Provider for Craft CMS

we are a small team in Berlin, Germany, developing editorial websites based on craft cms. A major publishing house is interested in our services. A condition to get contracted is us to provide a ...
2
votes
1answer
44 views

Loading dynamically-named classes in a plugin's service

I'm in the process of building a plugin that'll have extensible 'Providers' to allow developers to build connections to other services. These 'Providers' will just be classes that are built to an ...
0
votes
1answer
320 views

How to handle entry save in plugin when entryId is not set?

Referring to my older question, I have the entryId working on an existing entry. However I've noticed a new entry doesn't have an entryId set (makes sense). I have some custom information in text ...
1
vote
1answer
139 views

Need a way to connect to a webservice

I have a lot of data that sits outside of Craft (the data is in MS SQL Server) and I plan on writing a simple .NET Service which will return JSON. I need to display this data but not sure on how to ...
2
votes
1answer
925 views

How do I call a service from my controller in a plugin?

I'm writing a plugin, and used plugin.io to generate my scaffolding. In my controller I am attempting to call a service, and getting an error. This is my service code from my generated plugin it ...
1
vote
1answer
53 views

Getting database error when calling CateogoryService method

I have a PHP file in the public_html titled categories.php with the following code: namespace Craft; $craft = require '../craft/app/bootstrap.php'; $categories = $craft->categories->...
1
vote
1answer
444 views

Update multiple database entries via controller

I've inherited a Craft site that is a mix of a custom plugin (the main site) plus a Laravel Dingo plugin (behind which the bulk of the data in the db lives), plus Solr, and I'm trying to untangle it. ...
1
vote
1answer
275 views

Listen to onSetStatus event

I wanted to listen to the onSetStatus event of the SetStatusElementAction and used the same code like in the EntryElementType class: $setStatusAction = craft()->elements->getAction('SetStatus');...
1
vote
1answer
163 views

saveEntry() not firing

I'm using code I've been using to update existing entries for a while now and it's failing to fire following the 2.5 upgrade. Trying to figure out what might have changed, or if there's something I'm ...
2
votes
2answers
52 views

How do I make a service only runable by the server?

I've created an action that calls a service. The action will be called by a cron task. I want to set this up so that ONLY the cron task can call the action. It's important that it can not be run by ...
0
votes
2answers
1k views

Using Services to get all the Categories related to an Entry?

In a plugin, I've been advised to try to use craft built-in services instead of direct db queries. So can anyone help with this: For an entry type that includes a categories field, how to get all the ...
2
votes
1answer
511 views

How to catch errors in a service and return to a controller?

How do you handle “catching” errors in a plugin service and return the error to the plugins controller? To be more specific... I am sending an Ajax request to a controller, that controller is ...
3
votes
1answer
620 views

Inserting multiple records in a plugin

I'm building a plugin and have a form in the plugin's CP page that allows admins to save access codes. The form is a simple textarea where each line is a separate access code. I'm wondering what the ...
2
votes
1answer
129 views

Using services/records etc in migrations

The database migrations documentation does say: Please note that we do not recommend using records directly within a migration Are there technical reasons for this recommendation, or is it ...
3
votes
1answer
492 views

How to tell if user exists

I am automatically creating users in a service, is there a way to check if user exists? I want to log in id user exist or save a new user if it doesn't, I have the following so far which will add a ...
2
votes
1answer
738 views

Plugin Settings: Attribute Types, and how to receive

I have two small arrays I want to store in my plugin settings, though I'm stuck at what the AttributeType:: should be, as well as how to retrieve the actual values. The arrays I want to store look ...
2
votes
1answer
848 views

Issues with Twig template includes when rendering from a service called from a CP-triggered event

I have a listener for the entries.saveEntryevent that is calling a service, which generates an email from a rendered template. The template is attempting to import macros. MyaddonPlugin.php::init() ...
1
vote
0answers
49 views

An extra event upon usergroup assignment onAssignUserToGroup [closed]

I have come across a scenario where I need an event like "onAssignUserToGroup". This is purely for a client request and to modify functionality in the backend CP for my plugin, but this is the second ...
6
votes
3answers
2k views

setContent() vs $entry->getContent()->foo

I'm a bit confused about the usage of these two. Let's say I want to create a new entry from a controller. For me, the nicer option would be to user something like this: $entry = new EntryModel(); $...
5
votes
2answers
2k views

Populate a record with a model?

In a follow up to my earlier question, I'm focusing on cleaning up my code to keep it incredibly simple. I've moved on from the Controller and Model to the Model and Service. Typically you would have ...
1
vote
1answer
240 views

MVC - Should these be seperate controllers/models etc

I hope this is the right place to post this, it's more a question on MVC for plugin development. I'm developing a plugin to extend SproutForms to add users to Campaign Monitor lists. So far I've got ...
3
votes
1answer
1k views

Service not defined

I'm trying to build my first plugin using a service but i can't seem to get it to work. The file is named CampaignReports_CampaignMonitorService.php and it's in the services folder of my plugin. ...
2
votes
1answer
652 views

How can I use a session consistently in a service and variable?

I’m working on a simple cart and trying to utilize the user session id to keep track of things. The session getting saved to the database doesn't match the session that’s being displayed in ...
6
votes
1answer
612 views

Allow anonymous submission on a custom element type?

I have a custom element type that I want to allow anonymous submission from the front-end. I have a solid concept on how the form data is passed but I seem to be missing something. I have the ...
2
votes
1answer
857 views

Whats the best way to save a new entry in my plugin?

I have a channel section by the name of order. What I need is that every time a user clicks a button on the front end the data of the form is sent to my plugin which then uses the data to create a new ...
1
vote
1answer
411 views

Error when calling methods between two services (triggered by init)

I have two Services in my plugin. MyPluginService is the "main" service, and MyPlugin_OtherService accomplishes some other tasks (when it is occasionally needed). There is an init method in ...