cakephp - save pdf on server fpdf

I am generating a pdf with fpdf in cakephp and I try to save it on the server.I do it like this : $fpdf->Output("D:/Files/mypdf.pdf",'F'); but it doesn't save. I think it doesn't find the folder, but I don't know how specified it?I have put the all the right on the folder.I don't know if it is a cakephp restriction or just my directory?...Read more

cakephp - Shopify Webhook getting called multiple times

In my shopify store I have setup an order creation webhook. The webhook points to a Cakephp action URL which receives the data from webhook as following:-$content = file_get_contents ( "php://input" );After that it is saving this order data to the app database as:-$orderData =array('order'=>$data['order_number'],'details'=>$content);$orders = new Order ();$orders->saveall($orderData);Now the issue is that for each single order created the webhook is getting invoked multiple times. Although it performs the necessary action in the first ...Read more

associations - Cakephp 3.x: accessing variable through associated table

I have an expense table that has an associated Annual Operating Budget table. $this->belongsTo('AnnualOperatingBudgets', [ 'foreignKey' => 'annual_operating_budgets_id' ]);That Annual Operating Budget Table is associated with an AZinstitution table. $this->belongsTo('Azinstitutions', [ 'foreignKey' => 'azinstitutions_id', 'joinType' => 'INNER' ]);When I view an Expense I can display the foreignKey to the Institution Table that is in the Annual Operating Budget table but what I want t...Read more

pagination - paginate results in cakephp not giving correct results

I have the following function in my controllerpublic function getDeleted(){ $options = array( 'conditions' => array('deleteFlag' => 1 )); $assets = $this->Asset->find('all', $options); $this->set('assets', $this->paginate()); $this->render('index');}I'm using it to filter the results of a find('all') function based on one field. The query is returning the correct data, and if I debug($assets) before the view is rendered then the information is correct. However after I use $this->paginat...Read more

routes - CakePHP-3.5.4 - Reverse routing not working as expected

In my routes.php file I define:Router::prefix('admin', function ($routes) { $routes->connect( '/', [ 'plugin' => false, 'controller' => 'Users', 'action' => 'dashboard' ], ['_name' => 'admin_dashboard'] ); $routes->fallbacks(DashedRoute::class);});In controller, i do:debug(Router::url(['_name' => 'admin_dashboard']));It prints /admin which is correct.But if, in the same controller, i do:debug(Router::url([ 'prefix' => 'admin', 'plugin' => fal...Read more

Admin index route ignored w/ CakePHP 2.1

I'm working on a CakePHP 2.1 project and I have an issue concerning the "homepage" for admin panel.When I enter : mysite.com/adminI have a message telling me "AdminController cannot be found".I declared this route in config/routes.php :Router::connect('/admin', array('controller' => 'mycontroller', 'action' => 'index', 'admin' => true));And when I enter mysite.com/admin/mycontroller as URI, it works.Do you have an idea ?Thank you in advance.Edit | My routes.php file :`/** * Here, we are connecting '/' (base path) to controller called '...Read more

Make CakePHP consider two different routes/models for same path?

I have a website that has users and entries, both of which are stored in a database. Every entry has its own page, using its slug, and every user has a public profile, using its username. Their respective URLs might look something like this:Entry: https://example.com/hello-worldUser: https://example.com/test-userRefactoring said website with CakePHP 3.4 (the original being built with “vanilla” PHP), I implemented the following routes:$routes->connect('/:slug', ['controller' => 'Entries', 'action' => 'view'], ['pass' => ['slug'...Read more

routes - how to give loginredirect in cakedc, Cakephp 3.0

How to give loginredirect in cakephp while using cakedc Users plugin and also tell where these changes are to be done src/controller/AppController or vendor/cakedc/users/src/Controller/AppControllerAppContoller of cakedc users plugin class AppController extends BaseController { public function initialize() { parent::initialize(); $this->loadComponent('Security'); $this->loadComponent('Csrf'); $this->loadComponent('CakeDC/Users.UsersAuth', ['loginAction' => ['controller...Read more

How to do Associations between models in different databases using cakephp 3?

During last week I have been stuck with a scaling-related problem in cakephp 3.0.Basically, I designed a application for e-commerce that will serve several clients. Each store will sell its products in a specific subdomain (client1.application.com; client2.application.com, etc). All the stores will share the same application source.I want to have a common database for user authentication and other common resources, like tables for cities, countries, etc, so that all users can access all e-commerce stores that use this application with same logi...Read more

cakephp - Highcharts column chart rendering transparent columns in IE8

The column chart renders fine on all browsers except IE8. This is such a strange error. I can't replicate it in jsfiddle (yes I tried with the Jquery version I am using-1.9.1 as well)but I put the code on it in hopes someone has faced the same problem before. http://jsfiddle.net/danushkab/kp5es/6/$('#monthlychart').highcharts({ chart: { type: 'column', events: { click: function(event) { location = '/GVEMS_2.0/cvh/monthConsumption?date=08/2013&building=cvhcampus'; } } }, title: { ...Read more

CakePHP : Multiple hasOne Model Relations

I'm trying to create an application which should help distribute work to employees or volunteers on a irregular time schedule based on their availabilities. Anyway, here are my models and the relations between them :Users hasMany JobsJobs belongTo UsersUsers hasMany AvailabilitiesAvailabilities belongTo UsersJobs hasOne PeriodsPeriods belongTo JobsAvailabilities hasOne PeriodsPeriods belongTo AvailabilitiesThe problem is that "Periods" is on the receiving side of two hasOne relationships and, if I'm not wrong, it's something you can't do in Cak...Read more

Using DomPDF in Cakephp Delivers an error Cannot redeclare class Dompdf\View\PdfView

I have a problem printing a PDF using CakePHP and DomPDF as soon I want to fetch some data from the Database before printing the pdf. Without fetching the Data, it works like a charme. My function is the following:public function tourpdf($tourid = null){ $contain = ['Deliveries','Deliveries.Articletransactions','Deliveries.Orders','Deliveries.Orders.Customers', 'Deliveries.Articletransactions.Orderarticles','Deliveries.Articletransactions.Orderarticles.Articles']; $tour = $this->Tours->get($tourid) ->contain($co...Read more

How to implement dompdf in cakephp 3?

I just making website that can make html file into pdf using cakephp 3 as php framework.this is my code in layout as default.ctp for pdf view that i want to convert<?php require_once(APP . 'Vendor' . DS . 'dompdf' . DS . 'dompdf_config.inc.php'); spl_autoload_register('DOMPDF_autoload'); $dompdf = new DOMPDF(); $dompdf->set_paper = 'A4';$dompdf->load_html(utf8_decode($content_for_layout), Configure::read('App.encoding'));$dompdf->render();echo $dompdf->output();when i try to run it, it some error like thisError: Class 'Configure...Read more