Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony 4.x compatibility for Propel1 #506

Open
wants to merge 28 commits into
base: 1.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
398e721
change propel.configuration and propel.logger services to be public t…
jwong-dayspring May 11, 2018
51c7ab7
detect and handle difference in yaml format from symfony/yaml 3.3 and…
jwong-dayspring May 11, 2018
b2986b9
add reset() function to PropelDataCollector
jwong-dayspring May 11, 2018
25d59bb
Merge branch 'add_datacollector_reset' into 1.6
jwong-dayspring May 11, 2018
476c0f1
detect and handle difference in yaml format from symfony/yaml 3.3 and…
jwong-dayspring May 11, 2018
751ec8f
Added classname to the create buildtime config file in cache/.../propel
Jul 11, 2018
4d8b7cf
fix issue with rendering propel profiler
jwong-dayspring Mar 6, 2019
283e38b
update travis to test on php 7.3/7.4
jwong-dayspring Apr 9, 2021
cd4449f
replace boolean flags with bit flags
Apr 9, 2021
fe6f0b6
update versioning to be compatible with symfony ^4.0
Apr 9, 2021
a4b6768
Merge pull request #2 from dayspring-tech/add_datacollector_reset
Apr 9, 2021
48d87de
Merge branch '1.6' into classname-fix
Apr 9, 2021
ef668f5
Merge pull request #1 from dayspring-tech/classname-fix
Apr 9, 2021
c7a3e67
Merge branch '1.6' into feature/1.7
Apr 9, 2021
43d0faa
configure propel commands for Symfony 4
Apr 13, 2021
0938fd7
make propel.build_properties.class public
Apr 13, 2021
a984f6c
create file_locator alias that's public to get around warning
Apr 13, 2021
bc9a0c9
replace deprecated Twig_Extension with AbstractExtension
Apr 14, 2021
878a83f
Feature/17 GitHub actions (#3)
Apr 20, 2021
45062c1
Update readme to include 1.7 branch
jwong-dayspring Apr 22, 2021
bf80e3e
replace deprecated DefinitionDecorator with ChildDefinition
May 3, 2021
4f031d9
fix error when trying to open Propel profiler
jwong-dayspring Jun 29, 2022
9db6c91
fix typo
jwong-dayspring Jun 29, 2022
ff35388
Merge pull request #4 from dayspring-tech/fix/profiler_for_in_if
jwong-dayspring Jun 29, 2022
b897e29
prep for package release
jwong-dayspring Dec 20, 2022
5e64ec3
use dayspring-tech/propel1
mdenson-dayspring Apr 14, 2023
635dda0
fix propel path
nibsirahsieu Jul 12, 2023
2fc92c8
Merge pull request #10 from nibsirahsieu/fix_propel_path
jwong-dayspring Jul 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: PHP Composer

on:
push:

jobs:
test:
runs-on: ubuntu-18.04

strategy:
fail-fast: false
matrix:
php: [ '7.2', '7.3', '7.4' ]
dereuromark marked this conversation as resolved.
Show resolved Hide resolved
composer: [ '', '--prefer-lowest' ]

steps:
- uses: actions/checkout@v2

- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: sqlite3, zip
coverage: xdebug
tools: composer:v1

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-dir)"
working-directory: ./

- name: cache dependencies
id: angular-dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-

- name: Validate composer.json and composer.lock
run: composer validate
working-directory: ./

- name: Install dependencies
env:
COMPOSER_FLAGS: ${{ matrix.composer }}
run: composer update ${COMPOSER_FLAGS} --prefer-source
working-directory: ./

- name: Run Tests
run: composer run-script ci-test
working-directory: ./
env:
SYMFONY_DEPRECATIONS_HELPER: weak
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ protected function createBuildTimeFile($file)
<datasource id="%name%">
<adapter>%adapter%</adapter>
<connection>
<classname>%classname%</classname>
<dsn>%dsn%</dsn>
<user>%username%</user>
<password>%password%</password>
Expand All @@ -402,6 +403,7 @@ protected function createBuildTimeFile($file)
, array(
'%name%' => $name,
'%adapter%' => $datasource['adapter'],
'%classname%'=> $datasource['connection']['classname'],
'%dsn%' => $datasource['connection']['dsn'],
'%username%' => $datasource['connection']['user'],
'%password%' => isset($datasource['connection']['password']) ? $datasource['connection']['password'] : '',
Expand Down Expand Up @@ -468,7 +470,7 @@ protected function getCacheDir()
*/
protected function getFileLocator()
{
return $this->getContainer()->get('file_locator');
return $this->getContainer()->get('propel.file_locator');
}

/**
Expand Down
5 changes: 5 additions & 0 deletions DataCollector/PropelDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public function __construct(PropelLogger $logger, \PropelConfiguration $propelCo
$this->propelConfiguration = $propelConfiguration;
}

public function reset()
{
$this->logger->reset();
}

/**
* {@inheritdoc}
*/
Expand Down
3 changes: 1 addition & 2 deletions DataFixtures/Dumper/YamlDataDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ protected function transformArrayToData($data)
$data,
$inline = 3,
$indent = 4,
$exceptionOnInvalidType = false,
$objectSupport = true
$flags = Yaml::DUMP_OBJECT
);
}
}
3 changes: 2 additions & 1 deletion DependencyInjection/PropelExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function load(array $configs, ContainerBuilder $container)
$config = $processor->processConfiguration($configuration, $configs);

// Composer
if (file_exists($propelPath = $container->getParameter('kernel.root_dir') . '/../vendor/propel/propel1')) {
if (file_exists($propelPath = $container->getParameter('kernel.root_dir') . '/../vendor/dayspring-tech/propel1')) {
$container->setParameter('propel.path', $propelPath);
}
if (file_exists($phingPath = $container->getParameter('kernel.root_dir') . '/../vendor/phing/phing/classes')) {
Expand Down Expand Up @@ -67,6 +67,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('propel.xml');
$loader->load('converters.xml');
$loader->load('console.xml');
}

// build properties
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/Security/UserProvider/PropelFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\ChildDefinition;

/**
* PropelFactory creates services for Propel user provider.
Expand All @@ -41,7 +41,7 @@ public function __construct($key, $providerId)
public function create(ContainerBuilder $container, $id, $config)
{
$container
->setDefinition($id, new DefinitionDecorator($this->providerId))
->setDefinition($id, new ChildDefinition($this->providerId))
->addArgument($config['class'])
->addArgument($config['property'])
;
Expand Down
5 changes: 5 additions & 0 deletions Logger/PropelLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch
$this->stopwatch = $stopwatch;
}

public function reset()
{
$this->queries = array();
}

/**
* {@inheritdoc}
*/
Expand Down
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The two major branches being supported are:

* The `1.5` branch contains Propel *1.6+* integration for Symfony *2.8 LTS*.
* The `1.6` branch contains Propel *1.6+* integration for Symfony *3.0*.
* The `1.7` branch contains Propel *1.7+* integration for Symfony *4.0*.

If you are running on an older version, you may require one of the following versions of this bundle.

Expand Down
77 changes: 77 additions & 0 deletions Resources/config/console.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="propel.file_locator" alias="file_locator" public="true">
</service>

<service class="Propel\Bundle\PropelBundle\Command\AbstractCommand"
id="propel_bundle_propel.command.abstract_command"
abstract="true">
</service>
<service class="Propel\Bundle\PropelBundle\Command\BuildCommand"
id="propel_bundle_propel.command.build_command">
<tag name="console.command" command="propel:build" />
</service>
<service class="Propel\Bundle\PropelBundle\Command\DatabaseCreateCommand"
id="propel_bundle_propel.command.database_create_command">
<tag name="console.command" command="propel:database:create" />
</service>
<service class="Propel\Bundle\PropelBundle\Command\DatabaseDropCommand"
id="propel_bundle_propel.command.database_drop_command">
<tag name="console.command" command="propel:database:drop"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\FixturesDumpCommand"
id="propel_bundle_propel.command.fixtures_dump_command">
<tag name="console.command" command="propel:fixtures:dump"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\FixturesLoadCommand"
id="propel_bundle_propel.command.fixtures_load_command">
<tag name="console.command" command="propel:fixtures:load"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\FormGenerateCommand"
id="propel_bundle_propel.command.form_generate_command">
<tag name="console.command" command="propel:form:generate"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\GraphvizGenerateCommand"
id="propel_bundle_propel.command.graphviz_generate_command">
<tag name="console.command" command="propel:graphviz:generate"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\MigrationGenerateDiffCommand"
id="propel_bundle_propel.command.migration_generate_diff_command">
<tag name="console.command" command="propel:migration:generate-diff"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\MigrationMigrateCommand"
id="propel_bundle_propel.command.migration_migrate_command">
<tag name="console.command" command="propel:migration:migrate"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\MigrationStatusCommand"
id="propel_bundle_propel.command.migration_status_command">
<tag name="console.command" command="propel:migration:status"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\ModelBuildCommand"
id="propel_bundle_propel.command.model_build_command">
<tag name="console.command" command="propel:model:build"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\ReverseCommand"
id="propel_bundle_propel.command.reverse">
<tag name="console.command" command="propel:reverse"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\SqlBuildCommand"
id="propel_bundle_propel.command.sql_build_command">
<tag name="console.command" command="propel:sql:build"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\SqlInsertCommand"
id="propel_bundle_propel.command.sql_insert_command">
<tag name="console.command" command="propel:sql:insert"/>
</service>
<service class="Propel\Bundle\PropelBundle\Command\TableDropCommand"
id="propel_bundle_propel.command.table_drop_command">
<tag name="console.command" command="propel:table:drop"/>
</service>
</services>

</container>
8 changes: 4 additions & 4 deletions Resources/config/propel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
</parameters>

<services>
<service id="propel.configuration" class="%propel.configuration.class%" />
<service id="propel.configuration" class="%propel.configuration.class%" public="true"/>

<service id="propel.build_properties" class="%propel.build_properties.class%" />
<service id="propel.build_properties" class="%propel.build_properties.class%" public="true" />

<service id="propel.logger" class="%propel.logger.class%">
<service id="propel.logger" class="%propel.logger.class%" public="true">
<tag name="monolog.logger" channel="propel" />
<argument type="service" id="logger" on-invalid="null" />
<argument type="service" id="debug.stopwatch" on-invalid="null" />
</service>

<service id="propel.data_collector" class="%propel.data_collector.class%" public="false">
<tag name="data_collector" template="PropelBundle:Collector:propel" id="propel" />
<tag name="data_collector" template="@Propel/Collector/propel" id="propel" />
<argument type="service" id="propel.logger" />
<argument type="service" id="propel.configuration" />
</service>
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Collector/propel.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}
{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block toolbar %}
{% if collector.querycount %}
Expand Down
74 changes: 38 additions & 36 deletions Resources/views/Panel/configuration.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,44 @@
</tr>
</thead>
<tbody>
{% for name, config in configuration.datasources if config is iterable %}
<tr>
<th rowspan="5" style="vertical-align: top;">
{{ name }}
</th>
<th>Adapter</th>
<td>{{ config.adapter }}</td>
</tr>
<tr>
<th>DSN</th>
<td>{{ config.connection.dsn }}</td>
</tr>
<tr>
<th>Class</th>
<td>{{ config.connection.classname }}</td>
</tr>
<tr>
<th>Options</th>
<td>
<ul>
{% for key, value in config.connection.options %}
<li>{{ key }} : {{ value }}</li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<th>Attributes</th>
<td>
<ul>
{% for key, value in config.connection.attributes %}
<li>{{ key }} : {{ value }}</li>
{% endfor %}
</ul>
</td>
</tr>
{% for name, config in configuration.datasources %}
{% if config is iterable %}
<tr>
<th rowspan="5" style="vertical-align: top;">
{{ name }}
</th>
<th>Adapter</th>
<td>{{ config.adapter }}</td>
</tr>
<tr>
<th>DSN</th>
<td>{{ config.connection.dsn }}</td>
</tr>
<tr>
<th>Class</th>
<td>{{ config.connection.classname }}</td>
</tr>
<tr>
<th>Options</th>
<td>
<ul>
{% for key, value in config.connection.options %}
<li>{{ key }} : {{ value }}</li>
{% endfor %}
</ul>
</td>
</tr>
<tr>
<th>Attributes</th>
<td>
<ul>
{% for key, value in config.connection.attributes %}
<li>{{ key }} : {{ value }}</li>
{% endfor %}
</ul>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
4 changes: 3 additions & 1 deletion Tests/AutoloadAliasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Propel\Bundle\PropelBundle\Tests;

class AutoloadAliasTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase;

class AutoloadAliasTest extends PHPUnit_Framework_TestCase
{
public function testOldNamespaceWorks()
{
Expand Down
Loading