Giter Club home page Giter Club logo

sonataclassificationbundle's Introduction

SonataClassificationBundle

Symfony SonataClassificationBundle

Latest Stable Version Latest Unstable Version Psalm Type Coverage License

Total Downloads Monthly Downloads Daily Downloads

Branch Github Actions Code Coverage Documentation
4.x Test Coverage Status Documentation Status
5.x Test Coverage Status Documentation Status

Documentation

Check out the documentation on the official website.

Support

For general support and questions, please use StackOverflow.

If you think you found a bug or you have a feature idea to propose, feel free to open an issue after looking at the contributing guide.

License

This package is available under the MIT license.

sonataclassificationbundle's People

Contributors

azlotnikov avatar binhle410 avatar bladrak avatar core23 avatar covex-nn avatar dmarkowicz avatar enekochan avatar franmomu avatar greg0ire avatar gremo avatar hason avatar jerome-fix avatar jlamur avatar jordisala1991 avatar kunicmarko20 avatar lemorragia avatar nicovak avatar oskarstark avatar phansys avatar plouc avatar qsomazzi avatar rande avatar rmzamora avatar sagikazarmark avatar sonataci avatar soullivaneuh avatar sylvaindeloux avatar vincentlanglet avatar wbloszyk avatar yositaniwebware avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonataclassificationbundle's Issues

How to recover categories by sorting by "position"

I would like to do in a CategoryController :

$categories = $this->container->get('sonata.classification.manager.category')->getCategories('ORDER BY position');

The goal is to display in the view, the categories sorted by position.
Because I don't understand in admin / sonata / classification / category / create, the role of field position, I tried to change the order but in my view nothing is sorted.

But I don't know how to do this. Override CategoryManager ? I tried to do :

(In loadCategories())

/**
 * Load all categories from the database, the current method is very efficient for < 256 categories
 *
 */
protected function loadCategories()
{
  ...

    $categories = $this->getObjectManager()->createQuery(sprintf('SELECT c FROM %s c INDEX BY c.id ORDER BY position', $class))
        ->execute();

...

and the ORDER BY position work. In my view, my categories are sorted.
Thanks.

Collections and tags does not work

Hello,

When i want to create a new collection or a new tag i have this exception:

Please define a type for field context in Sonata\ClassificationBundle\Admin\CollectionAdmin

Attempted to call method "ifTrue" on class "Sonata\AdminBundle\Form\FormMapper".

I'm facing that issue when i'm trying to access the route "/admin/sonata/classification/context/create". I have no ideas where it could come from. I've been following the Documentation step by step.

Attempted to call method "ifTrue" on class "Sonata\AdminBundle\Form\FormMapper".
in vendor/sonata-project/classification-bundle/Admin/ContextAdmin.php at line 27 :

protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->ifTrue($this->getSubject()->getId() === null)
->add('id')
->ifEnd()
->add('name')

Here my composer.json :

"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0.12",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/core-bundle": "~2.2@dev",
"sonata-project/notification-bundle": "~2.3",
"knplabs/knp-markdown-bundle": "~1.2",
"videlalvaro/php-amqplib": "~2.4",
"liip/monitor-bundle": "~2.0",
"symfony-cmf/routing-bundle": "1.4.
@dev",
"jms/serializer-bundle": "0.13.*@dev",
"sonata-project/formatter-bundle": "~2.3",
"sonata-project/markitup-bundle": "~2.1",
"sonata-project/intl-bundle": "~2.2",
"sonata-project/cache-bundle": "~2.2",
"sonata-project/seo-bundle": "~1.1",
"sonata-project/easy-extends-bundle": "~2.1",
"sonata-project/admin-bundle": "~2.3",
"sonata-project/doctrine-orm-admin-bundle": "~2.3",
"sonata-project/user-bundle": "~2.2",
"sonata-project/classification-bundle": "dev-master",
"sonata-project/news-bundle": "dev-master",
"sonata-project/timeline-bundle": "~2.2@dev",
"sonata-project/media-bundle": "~2.4@dev",
"sonata-project/page-bundle": "~2.3@dev"
},

And my AppKernel.php :

$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Spy\TimelineBundle\SpyTimelineBundle(),
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\NotificationBundle\SonataNotificationBundle(),
new Sonata\MarkItUpBundle\SonataMarkItUpBundle(),
new Sonata\FormatterBundle\SonataFormatterBundle(),
new Sonata\IntlBundle\SonataIntlBundle(),
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\SeoBundle\SonataSeoBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
new Sonata\ClassificationBundle\SonataClassificationBundle(),
new Sonata\MediaBundle\SonataMediaBundle(),
new Sonata\NewsBundle\SonataNewsBundle(),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\TimelineBundle\SonataTimelineBundle(),
new Sonata\PageBundle\SonataPageBundle(),
new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
new Application\Sonata\ClassificationBundle\ApplicationSonataClassificationBundle(),
new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),
new Application\Sonata\NewsBundle\ApplicationSonataNewsBundle(),
new Application\Sonata\TimelineBundle\ApplicationSonataTimelineBundle(),
new Application\Sonata\PageBundle\ApplicationSonataPageBundle(),
new Application\Sonata\NotificationBundle\ApplicationSonataNotificationBundle(),
new AppBundle\AppBundle(),
);

I wonder is this would help :

1 - DEBUG - Router Sonata\PageBundle\Route\CmsPageRouter was not able to match, message "No site defined"

classification-bundle/Controller/CategoryAdminController.php on line 79

Fatal error: Call to a member function getContext() on a non-object in /vendor/sonata-project/classification-bundle/Controller/CategoryAdminController.php on line 79

Uncaught PHP Exception RuntimeException: "The first category must be the root" at /NetBeansProjects/COBASV/vendor/sonata-project/classification-bundle/Entity/CategoryManager.php line 211 {"exception":"[object](RuntimeException: The first category must be the root at /NetBeansProjects/COBASV/vendor/sonata-project/classification-bundle/Entity/CategoryManager.php:211)"} []

Can I use SonataTranslationBundle for translate SonataClassificationBundle?

Hi!
I want to translate SonataClassificationBundle with SonataTranslationBundle but I cant correctly extent the Category.orm.yml config using Gedmo additions: I catch error with duplicate configuration for already configured

[Doctrine\ORM\Mapping\MappingException]                                                                                          
  Duplicate definition of column 'name' on entity 'Application\Sonata\ClassificationBundle\Entity\Category' in a field or discrim  
  inator column mapping.

Is there a legal way to translate entities from SonataClassificationBundle with SonataTranslationBundle?

Error Sonata Classification Bundle

Hello,

I have installed Classification bundle and also install its depends bundle, I have configured all steps from http://sonata-project.org/bundles/classification/master/doc/index.html
But I have faced following error

PHP Fatal error: Class 'Application\Sonata\ClassificationBundle\SonataClassificationBundle' not found in myproject\app\AppKernel.php in line PHP Stack trace:

I have also registered this bundle in AppKernal and Application bundle found in src source directory, can anyone has idea about it?

Thanks

documentation?

I need to add tagging to the Sonata Media Bundle's Meta data, this looks like the bundle to do it with, but there does not appear to be any documentation.

Can I help with that, assuming I can get some pointers on exactly what this Bundle does and how to install it from some folks that have done it.

Error on admin/sonata/classification/category/tree when database is empty

Hello,

I encountered an issue in dev master version of SonataClassificationBundle :

Call to a member function getContext() on boolean in 
[...]/SonataClassificationBundle/Controller/CategoryAdminController.php on line 80

I check the issue list but I do not see it, so I report here the bug. This bug only happen when database is empty. The schema is ok, but there is voluntarily no category and no context in my database.

If you want to check, this is my composer.json file :

"require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "doctrine/migrations": "~1",
        "doctrine/doctrine-migrations-bundle": "~1",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~4.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "~1.3",
        "friendsofsymfony/message-bundle": "^1.2",
        "sonata-project/admin-bundle": "^2.4@dev",
        "sonata-project/block-bundle": "~2.3",
        "sonata-project/classification-bundle": "dev-master",
        "sonata-project/datagrid-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "^2.4@dev",
        "sonata-project/easy-extends-bundle": "^2.1",
        "sonata-project/exporter": "^1.4",
        "sonata-project/intl-bundle": "^2.2",
        "sonata-project/user-bundle": "dev-master",
        "knplabs/knp-menu-bundle": "~2.0",
        "knplabs/knp-menu": "~2.0"
    },

Here is more information about my project and my server :

I already developed an unit test case which fails on that bug and I already fixed it, I will push a request in a few minutes, I have to to read your contribution rules before that.**

Sorry for my english, I am not very fluent.

There is no column with name 'slug' on table 'classification__collection'

Hi,

After updating a symfony2 project with composer I had to update media bundle because It required classification bundle.
So I follow the installation and now I getting [Doctrine\DBAL\Schema\SchemaException]
There is no column with name 'slug' on table 'classification__collection'.

"php": ">=5.3.3",
"symfony/symfony": "2.5.",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "1.0.
@dev",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~1.3@dev",
"sonata-project/core-bundle": "dev-master",
"sonata-project/admin-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/easy-extends-bundle": "dev-master",
"sonata-project/user-bundle": "dev-master",
"sonata-project/datagrid-bundle": "~2.2@dev",
"sonata-project/classification-bundle": "~2.3@dev",
"jms/serializer-bundle": "~0.11",
"sonata-project/media-bundle": "2.4.@dev",
"stof/doctrine-extensions-bundle": "~1.1@dev",
"knplabs/knp-paginator-bundle": "~2.4",
"hwi/oauth-bundle": "0.4.
@dev"

Tags slugs does not work with space and special characters

Everything is in the title.

Even though tags get their own slugs, links does not seems to work when there's a space or any special character in tags. It return a No post found. (with SonataNewsBundle). Slugs are correctly formatted, space are replaced by "-" and special characters are simply missing. Editing the tag name and replacing for example a space with a "-" make it works.

Occurred with spaces and special characters (<, !, ?, etc) as far as I tested.

Being able to edit the slug afterward without modify the tag name would be a neat feature too.

I wish I could make the PR myself (I tried..) but I still lack comprehension for some parts.

Class 'Sonata\ClassificationBundle\Document\BaseContext' does not exist

I recently updated my SonataMediaBundle to dev-master and since then the SonataClassificationBundle became required in addition to the SonataDatagridBundle.

After updating with composer I started easy-extends for the SonataMediaBundle.

But without success and the following error message:
Class 'Sonata\ClassificationBundle\Document\BaseContext' does not exist

I am running ORM and ODM and it looks like there seems to be a problem with the ODM mapping?

Broken Preject...

Updated my project via "composer update" yesterday now I am getting the following error:

    [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]   
    The service "sonata.classification.api.form.type.category" has a dependency  
     on a non-existent service "jms_serializer.metadata_factory". 

Have looked all over and can't seem to find a fix.

My current composer file looks like this...

            "php": ">=5.5.0",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "~1.3",

    "knplabs/knp-paginator-bundle": "2.3.*",
    "knplabs/knp-menu-bundle": "1.1.*",
    "knplabs/knp-menu": "1.1.*",

    "sonata-project/intl-bundle": "dev-master",
    "sonata-project/media-bundle": "dev-master",
    "sonata-project/core-bundle": "~2.2@dev",
    "sonata-project/news-bundle": "dev-master",
    "sonata-project/formatter-bundle": "~2.2@dev",
    "sonata-project/classification-bundle": "~2.2@dev",
    "sonata-project/easy-extends-bundle": "dev-master",
    "sonata-project/block-bundle": "2.2.*@dev",
    "sonata-project/doctrine-orm-admin-bundle": "dev-master",
    "sonata-project/user-bundle": "dev-master",
    "sonata-project/admin-bundle": "2.2.*@dev",        
    "sonata-project/cache": "dev-master",
    "sonata-project/markitup-bundle": "2.1.*@dev",

    "egeloen/ckeditor-bundle": "~2.0",
    "jms/serializer-bundle": "dev-master",

    "nelmio/api-doc-bundle": "2.5.*@dev",
    "friendsofsymfony/rest-bundle": "1.3.*@dev",

    "triplepoint/php-units-of-measure": "dev-develop",
    "bcc/extra-tools-bundle": "dev-master"

Please help :)

no way to override validation.xml

I need to increase the max length of the category name and I just copied and modified for my needs validation.xml in Application\Sonata\ClassificationBundle\Resources\config
but no way to make it work... (already tried with clear cache)
Don't know if is a bug or what ?!

The error is always about 32 chars max length (the default in vendor/.../validation.xml)

Here is my version of validation.xml

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


<class name="Application\Sonata\ClassificationBundle\Entity\Category">

    <property name="name">
        <constraint name="NotBlank" />
        <constraint name="NotNull" />
        <constraint name="Length">
            <option name="min">2</option>
            <option name="max">64</option>
        </constraint>
    </property>

</class>

Thanks for any answer

Admin route to context

Hi,

I'm trying to check out what's happening when attempting to CRUD contexts. Currently when I hover over or click on the link in the admin section it redirects to: /admin/sonata/classification/collection/list instead of /admin/sonata/classification/context/list

I've checked the admin.xml service definition and it seems to be mapped out correctly. Likewise dumping the container shows the service(s) are enabled and available. Likewise the correct routes are available too. If I enter /admin/sonata/classification/collection/list into my browser it loads the correct controller so it seems that the routes aren't being correctly generated.

Here's my current setup:

composer.yml

"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "twig/extensions": "dev-master",
    "jms/security-extra-bundle": "^1.5",
    "jms/serializer-bundle": "~0.11",
    "doctrine/doctrine-migrations-bundle": "^1.1",
    "doctrine/doctrine-fixtures-bundle": "^2.3",
    "symfony-cmf/routing-bundle": "~1.1",
    "knplabs/gaufrette": "^0.1.6",
    "knplabs/knp-menu-bundle": "dev-master",
    "michelf/php-markdown": "1.4.0",
    "friendsofsymfony/comment-bundle": "~2.0@dev",
    "sonata-project/core-bundle": "2.3.x-dev",
    "sonata-project/datagrid-bundle": "~2.2@dev",
    "sonata-project/notification-bundle": "dev-master",
    "videlalvaro/php-amqplib": "^2.6",
    "liip/monitor-bundle": "^2.1",
    "sonata-project/formatter-bundle": "~2.4@dev",
    "sonata-project/intl-bundle": "~2.2@dev",
    "predis/predis": "^1.0",
    "sonata-project/cache-bundle": "~2.1@dev",
    "sonata-project/seo-bundle": "~2.0",
    "sonata-project/easy-extends-bundle": "~2.1@dev",
    "sonata-project/block-bundle": "~2.3@dev",
    "sonata-project/classification-bundle": "dev-master",
    "sonata-project/media-bundle": "~2.4@dev",
    "sonata-project/admin-bundle": "dev-master",
    "sonata-project/doctrine-orm-admin-bundle": "~2.4@dev",
    "sonata-project/news-bundle": "~2.3@dev",
    "sonata-project/comment-bundle": "~2.2@dev",
    "sonata-project/page-bundle": "~2.4@dev",
    "sonata-project/user-bundle": "~2.2@dev"
}

/app/config/sonata/sonata_classfication_bundle.yml

sonata_classification:
    class:
        tag:          Application\Sonata\ClassificationBundle\Entity\Tag
        category:     Application\Sonata\ClassificationBundle\Entity\Category
        collection:   Application\Sonata\ClassificationBundle\Entity\Collection
        context:      Application\Sonata\ClassificationBundle\Entity\Context
        media:        Application\Sonata\MediaBundle\Entity\Media

    admin:
        tag:
            class:        Sonata\ClassificationBundle\Admin\TagAdmin
            controller:   SonataAdminBundle:CRUD
            translation:  SonataClassificationBundle
        category:
            class:        Sonata\ClassificationBundle\Admin\CategoryAdmin
            controller:   SonataClassificationBundle:CategoryAdmin
            translation:  SonataClassificationBundle
        collection:
            class:        Sonata\ClassificationBundle\Admin\CollectionAdmin
            controller:   SonataAdminBundle:CRUD
            translation:  SonataClassificationBundle
        context:
            class:        Sonata\ClassificationBundle\Admin\ContextAdmin
            controller:   SonataAdminBundle:CRUD
            translation:  SonataClassificationBundle
 doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    ApplicationSonataClassificationBundle: ~
                    SonataClassificationBundle: ~
    dbal:
            types:
                json:     Sonata\Doctrine\Types\JsonType 

/app/config/sonata/sonata_admin_bundle.yml

dashboard:
    groups:
        sonata.admin.group.classification:
            items:
                - sonata.classification.admin.tag
                - sonata.classification.admin.category
                - sonata.classification.admin.collection
                - sonata.classification.admin.context

fetching parent_id from category fails

I'm trying to get all category content to sort the results yielding a readable category tree but somehow the parent_id does not come with the data.
Is this a bug or meant to be?
parent_id can be queried but to fetch all descendants this is useless...

$em = $this->modelManager->getEntityManager('Application\Sonata\ClassificationBundle\Entity\Category');
$qb = $em->createQueryBuilder();
$qb = $qb->add('select', 'u')
->add('from', 'Application\Sonata\ClassificationBundle\Entity\Category u');
$query = $qb->getQuery();

Perhaps I should use another category entity which supports tree building...

sonata-users › Classification bundle - Media bundle

Hi,

I´ve updated media bundle and had to add classification bundle because of the dependency. Since then I am getting this error when trying to batch load images.

c:\xampp183\php\php.exe "-c" "C:\xampp183\php\php.ini" app/console sonata:media:add-multiple --file=imagenesvinos-test.csv

16150 - 100Pipers_ScotchWhisky.jpg
A managed+dirty entity default can not be scheduled for insertion. : ["sonata.media.provider.image","default","C:
\xampp183\htdocs\ev2\web\bundles\ev\images\vinos\100Pipers_ScotchWhisky_ET.jpg"]
An exception occurred while executing 'INSERT INTO classification__context (name, enabled, created_at, updated_at,
id) VALUES (?, ?, ?, ?, ?)' with params ["default", 1, "2014-10-17 11:14:56", "2014-10-17 11:14:56", "default"]:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default' for key 'PRIMARY' : ["sonata.media
.provider.image","default","C:\xampp183\htdocs\espaciovinov2\web\bundles\evespaciovino\images\vinos\135An
iversario_Blend.jpg"]

I´m not using classification bundle, how can I disable it so its not a required field in the media admin?

Thanks!

Property count does not exist

Yesterday my setup still seemed to work. Today I get:

  [RuntimeException]                                                          
  An error occurred when executing the "'cache:clear --no-warmup'" command:   

    [Doctrine\ODM\MongoDB\Mapping\MappingException]                           
    An error occurred in Sonata\ClassificationBundle\Document\BaseCategory    


    [ReflectionException]                                                     
    Property count does not exist                                                                                      

I havn't seen any commit on this bundle that could cause this.

But I recognized this commit by @OskarStark :
sonata-project/SonataAdminBundle@926f159

It relates to MongoDB Collection. Maybe this is linked to the property count issue?

$objectCount = count($value);
$postCount   = count($data[$childFormBuilder->getName()]);

Changed to:

$collection->add(new $entityClassName());
$propertyAccessor->setValue($entity, $path, $collection);

Composer:

    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.6.*",
        "doctrine/orm": "2.5.*",
        "doctrine/dbal": "~2.4",
        "doctrine/doctrine-bundle": "~1.2",
        "doctrine/mongodb-odm": "^1.0",
        "doctrine/mongodb-odm-bundle": "~3.0",
        "sonata-project/core-bundle": "dev-master",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "sonata-project/cache-bundle": "dev-master",
        "sonata-project/classification-bundle": "dev-master",
        "sonata-project/media-bundle": "dev-master#1cc799eda0fa7dc0fb01045cb36747e89b4bffcf",
        "sonata-project/datagrid-bundle": "dev-master",
        "sonata-project/user-bundle": "dev-master",
        "sonata-project/intl-bundle": "dev-master",
        "sonata-project/easy-extends-bundle": "dev-master",
        "sonata-project/doctrine-mongodb-admin-bundle": "dev-master",
        "sonata-project/translation-bundle": "dev-master",

delete category bug

Example:

-Root
--cat1(parent root)
---cat2(parent cat1)
--cat3(parent root)

If you delete cat3 will be deleted (root,cat1,cat2,cat3)

tests are broken right now

https://travis-ci.org/sonata-project/SonataClassificationBundle/builds/34837186

1) Sonata\ClassificationBundle\Tests\Controller\Api\CategoryControllerTest::testPostCategoryAction
array_keys() expects parameter 1 to be array, null given
/home/travis/build/sonata-project/SonataClassificationBundle/vendor/sonata-project/core-bundle/Form/FormHelper.php:30
/home/travis/build/sonata-project/SonataClassificationBundle/Controller/Api/CategoryController.php:254
/home/travis/build/sonata-project/SonataClassificationBundle/Controller/Api/CategoryController.php:136
/home/travis/build/sonata-project/SonataClassificationBundle/Tests/Controller/Api/CategoryControllerTest.php:71

"Add Category" Fatal Error

When trying to add a new category from the Admin:

Catchable Fatal Error: Argument 1 passed to Symfony\Component\Form\Extension\Core\Type\ChoiceType::normalizeLegacyChoices() must be of the type array, null given, called in .../vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php on line 266 and defined

[Mapping] FAIL - The entity-class 'Application\Sonata\ClassificationBundle\Entity\Category' mapping is invalid:

I got this error

  • The field Application\Sonata\ClassificationBundle\Entity\Category#children is on the inverse side of a bi-directional relationship, but the specified mappedBy association on the target-entity Application\Sonata\ClassificationBundle\Entity\Category#parent does not contain the required 'inversedBy=children' attribute.

maybe is a typo in the SonataClassificationExtension?

$collector->addAssociation($config['class']['category'], 'mapManyToOne', array(
'fieldName' => 'parent',
'targetEntity' => $config['class']['category'],
'cascade' => array(
'remove',
'persist',
'refresh',
'merge',
'detach',
),
'mappedBy' => NULL,
'inversedBy' => NULL, <==== maybe: 'children' ?
'joinColumns' => array(
array(
'name' => 'parent_id',
'referencedColumnName' => 'id',
'onDelete' => 'CASCADE',
),
),
'orphanRemoval' => false,
));

Categories does not work

Hello,

When i want to create a new category, i have this exception :

Attempted to call method "if_true" on class "Sonata\AdminBundle\Form\FormMapper" in /var/www/.../vendor/sonata-project/classification-bundle/Admin/CategoryAdmin.php line 89.

i using the dev-master branch : "sonata-project/classification-bundle": "dev-master",

Document manager classes does not respect PageableManagerInterface

Methods getPager of these classes does not respect the signature introduced by PageableManagerInterface :

  • Sonata\ClassificationBundle\Document\CategoryManager
  • Sonata\ClassificationBundle\Document\CollectionManager
  • Sonata\ClassificationBundle\Document\TagManager

CategoryManager::getPager() be compatible with PageableManagerInterface::getPager()

Fatal error: Declaration of Sonata\ClassificationBundle\Document\CategoryManager::getPager() must be compatible with Sonata\CoreBundle\Model\PageableManagerInterface::getPager(array $criteria, $page, $limit = 10, array $sort = Array) in /home/inhack20/www/symfony/pandco_app_client/vendor/sonata-project/classification-bundle/Document/CategoryManager.php on line 21

The implementation of methods do not match:
CategoryManager::getPager(array $criteria, $page, $maxPerPage = 10);
PageableManagerInterface::getPager(array $criteria, $page, $limit = 10, array $sort = array());

"sonata-project/classification-bundle": "~2.2",
"sonata-project/core-bundle": "~2.3"

Undefined index: parent in vendor/sonata-project/doctrine-orm-admin-bundle/Guesser/FilterTypeGuesser.php line 64

I was trying to access the classification/category/list page in the Sonata admin area and got the following error:

Notice: Undefined index: parent in /var/www/project/vendor/sonata-project/doctrine-orm-admin-bundle/Guesser/FilterTypeGuesser.php line 64

It appears that the problem is because the field "parent" is not defined in any of the doctrine entity configuration files, even though it is defined as a property in the Model class Sonata\ClassificationBundle\Model\Category. What I would like to know is whether this was an over-sight or it is by design.

One solution would be to add a definition for the "parent" field in the extended bundle entity configuration file which will subsequently create a column in the database for the category table. Seeing as I don't know how it was designed to work, I want to know if that is the right solution for solving this problem.

Context cannot be null in new category creation

When i try to create a new category from sonata admin it throw me this error: Context cannot be null at vendor/sonata-project/classification-bundle/Entity/CategoryManager.php at line 127. I follow the installation instruction and here is my composer.json

"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/admin-bundle": "2.4.
@dev",
"sonata-project/doctrine-orm-admin-bundle": "2.3.@dev",
"knplabs/knp-paginator-bundle": "2.4.
@dev",
"stof/doctrine-extensions-bundle": "1.2.@dev",
"raulfraile/ladybug-bundle": "dev-master",
"sonata-project/user-bundle": "2.3.
@dev",
"sonata-project/datagrid-bundle": "2.2.@dev",
"sonata-project/ecommerce": "2.3.
@dev",
"sonata-project/news-bundle": "dev-master",
"sonata-project/easy-extends-bundle": "dev-master",
"sonata-project/classification-bundle": "dev-master",
"sonata-project/media-bundle": "2.3.@dev",
"sonata-project/translation-bundle": "2.3.
@dev",
"sonata-project/comment-bundle": "2.2.@dev",
"jms/serializer-bundle": " 0.13.
@dev",
"sonata-project/intl-bundle": "2.2.@dev",
"friendsofsymfony/rest-bundle": "1.5.
@dev",
"sonata-project/notification-bundle": "2.3.@dev",
"sonata-project/page-bundle": "2.3.
@dev",
"symfony-cmf/routing-bundle": "1.3.*@dev",
"cocur/slugify": "dev-master"
},

BC Break with 2.3

Hi,

commit 640f5ce break BC for 2.3 LTS in composer.

Please create a 2.3 branch, or revert the change.

  Problem 1
    - Installation request for sonata-project/classification-bundle dev-master -> satisfiable by sonata-project/classifi
cation-bundle[dev-master].
    - sonata-project/classification-bundle dev-master requires sonata-project/doctrine-orm-admin-bundle ~2.4@dev -> no m
atching package found.
  Problem 2
    - sonata-project/classification-bundle dev-master requires sonata-project/doctrine-orm-admin-bundle ~2.4@dev -> no m
atching package found.
    - symfony/framework-standard-edition 2.3.x-dev requires sonata-project/classification-bundle dev-master -> satisfiab
le by sonata-project/classification-bundle[dev-master].
    - Installation request for symfony/framework-standard-edition 2.3.x-dev -> satisfiable by symfony/framework-standard
-edition[2.3.x-dev].

If you intend to go forwoard by adding a dependency to 2.4, you should create a branch to keep BC

see https://github.com/sadortun/SonataClassificationBundle/tree/2.3

some terrible nightmare - News and Classification

so, during two days im trying to install News & Classification bundles but...

No entity manager defined for class Application\Sonata\ClassificationBundle\Entity\Tag

is only one thing i can see...

WTF, how to install that bundles, your docs are wrong!

Problem with SonataClassificationBundle.fr.xliff

In this f025c64 there are twice "breadcrumb.link_category_tree"

An exception has been thrown during the rendering of a template ("Invalid resource provided: "1.2"; Errors: [ERROR 1877] Element '{urn:oasis:names:tc:xliff:document:1.2}trans-unit': Duplicate key-sequence ['breadcrumb.link_category_tree'] in key identity-constraint '{urn:oasis:names:tc:xliff:document:1.2}K_unit_id'.

Notice: iconv(): Detected an illegal character in input string

Hello

Notice: iconv(): Detected an illegal character in input string
500 Internal Server Error - ContextErrorException

at ErrorHandler ->handleError ('8', 'iconv(): Detected an illegal character in input string', '/Users/vpak/Documents/www/copybet/vendor/sonata-project/classification-bundle/Model/Tag.php', '134', array('text' => 'Привет'))
at iconv ('utf-8', 'us-ascii//TRANSLIT', 'Привет')
in vendor/sonata-project/classification-bundle/Model/Tag.php at line 134
2015-08-25 21 21 41

How to extend Tag and Category entities to make ManyToOne relationship?

Hi everyone,

I'm using the ClassificationBundle "^2.2" version.

What I want to do is to make a ManyToOne relationship between tags and categories, but I have no result in mapping, and it is very bizarre.

So, I have extended my Tag and Category entities like this:

Tag entity

<?php

/**
 * This file is part of the <name> project.
 *
 * (c) <yourname> <youremail>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Application\Sonata\ClassificationBundle\Entity;

use Sonata\ClassificationBundle\Entity\BaseTag as BaseTag;
use Doctrine\ORM\Mapping as ORM;

/**
 * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
 *
 * References :
 *   working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
 *
 * @author <yourname> <youremail>
 */
class Tag extends BaseTag
{
    /**
     * @var integer $id
     */
    protected $id;

    /**
     * @ORM\ManyToOne(targetEntity="\Application\Sonata\ClassificationBundle\Entity\Category", inversedBy="tags")
     * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
     */
    protected $categories;

    /**
     * Get id
     *
     * @return integer $id
     */
    public function getId()
    {
        return $this->id;
    }


    /**
     * Add tags
     *
     * @param \Application\Sonata\ClassificationBundle\Entity\Category $category
     */
    public function addCategories(\Application\Sonata\ClassificationBundle\Entity\Category $category)
    {
        $this->categories[] = $category;
    }

    /**
     * Get tags
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCategories()
    {
        return $this->categories;
    }
}

Category entity

<?php

/**
 * This file is part of the <name> project.
 *
 * (c) <yourname> <youremail>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Application\Sonata\ClassificationBundle\Entity;

use Sonata\ClassificationBundle\Entity\BaseCategory as BaseCategory;
use Doctrine\ORM\Mapping as ORM;

/**
 * This file has been generated by the Sonata EasyExtends bundle ( http://sonata-project.org/bundles/easy-extends )
 *
 * References :
 *   working with object : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
 *
 * @author <yourname> <youremail>
 */
class Category extends BaseCategory
{
    /**
     * @var integer $id
     */
    protected $id;

    /**
     * @ORM\OneToMany(targetEntity="\Application\Sonata\ClassificationBundle\Entity\Tag", mappedBy="categories")
     */
    protected $tags;

    /**
     * Get id
     *
     * @return integer $id
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Add tags
     *
     * @param \Application\Sonata\ClassificationBundle\Entity\Tag $tag
     */
    public function addTags(\Application\Sonata\ClassificationBundle\Entity\Tag $tag)
    {
        $this->tags[] = $tag;
    }

    /**
     * Get tags
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTags()
    {
        return $this->tags;
    }
}

When I try to execute: app/console doctrine:schema:update --dump-sql

I have this message

Nothing to update - your database is already in sync with the current entity metadata.

Any information to solve this problem please?

Add 'type' field on categories, collections and tags to distinguish the entity they manager

Thomas,

I was thinking about adding a 'type' field on each of the classification bundle entities in order to easily retrieve for instance the product categories. This would avoid costly joins in queries and algorithm problems (for instance, a parent category without any product wouldn't show up instead of adding another join).

What would you think about that?

Query parameters are lost when redirecting to CategoryAdminController::treeAction

So when you have something like this:

$formMapper->add('category', 'sonata_type_model_list', [
    'required' => false,
], [
    'link_parameters' => [
        'context' => 'events',
        'hide_context' => true
    ]
]);

in your form, clicking on the list button of the widget looses the link_parameters in the redirection from listAction to treeAction.

This could be fixed by passing all the query parameters to the url:

class CategoryAdminController extends Controller
{
    public function listAction(Request $request = null)
    {
        if (!$request->get('filter') && !$request->get('filters')) {
            return new RedirectResponse($this->admin->generateUrl('tree', $request->query->all()));
        }
        // ...
    }
}

Impossible to add context from menu

Hello,

When i want to create a new context, i have this message :

Attempted to call method "if_true" on class "Sonata\AdminBundle\Form\FormMapper" in /var/www/.../vendor/sonata-project/classification-bundle/Admin/ContextAdmin.php line 27.

Cannot save new Category

When attempting to save a new category via SonataAdmin I get the following error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'enabled' cannot be null

Currently the form to create a new category does not include the enabled field. Likewise, when digging into the BaseCategory.orm.xml file, PHPStorm picks up an error that says:

"Attribute 'default' is not allowed to appear in element field"

My current composer looks as follows:

   "sonata-project/admin-bundle": "dev-master",
   "sonata-project/doctrine-orm-admin-bundle": "dev-master",
    "sonata-project/core-bundle": "dev-master",
    "sonata-project/easy-extends-bundle": "dev-master",
    "sonata-project/user-bundle": "dev-master",
    "sonata-project/datagrid-bundle": "dev-master",
    "sonata-project/formatter-bundle": "~2.3",
    "sonata-project/intl-bundle": "~2.2",
    "sonata-project/cache-bundle": "~2.2",
    "sonata-project/seo-bundle": "~1.1",
    "sonata-project/classification-bundle": "~2.2",
    "sonata-project/media-bundle": "~2.3",
    "sonata-project/news-bundle": "~2.3",

Category List Action bug

Impossible to access an attribute ("context") on a NULL variable ("") in SonataClassificationBundle:CategoryAdmin:list_tab_menu.html.twig at line 4

in list_tab_menu.html.twig : 'value': current_category.context.id
but there is no current_category variable passed to the template in the listAction (?)

Multiple category entities

Currently I have a hard task: I have to implement a site where Products and News are both organized in categories, but Product categories have a few extra fields. For example the product category needs to contain the margin for products under it.

Can I do that right now? If yes, how?

getRootCategories of categoryManager is not compartible with SonataMedia bundle

Sonata media bundle context field holds a string (that is the name of the context). When the getRootCategories is called the returned categories array has as index the id of the classification context that is mapped to the categories instead, so no matching categories are found for the context of Media Bundle.

To fix this i had to amend line 130 of Entity/Categorymanager to:
$categories[$category->getContext()->getName()] = $loadChildren ? $this->getRootCategory($category->getContext()) : $category;

Replaced the index from $category->getContext()->getId() to $category->getContext()->getName()

No identifier/primary key specified for Document 'Application\Sonata\ClassificationBundle\Document\Category'. Every Document must have an identifier/primary key.

The original issue started here:
#94

After easy-extending the ClassificationBundle I get the following:
No identifier/primary key specified for Document 'Application\Sonata\ClassificationBundle\Document\Category'. Every Document must have an identifier/primary key.

I've seen @stof fixing a similar issue here:

A fix was merged by @jwage here:

Is this related to the doctrine/mongodb-odm used by the ClassificationBundle?
I am currently using:

"doctrine/mongodb-odm": "1.0.*@dev",
"doctrine/mongodb-odm-bundle": "3.0.*@dev",        
"sonata-project/classification-bundle": "dev-master",
"sonata-project/doctrine-mongodb-admin-bundle": "dev-master",

"Position" field in CategoryAdmin only shows "0" all the time

When I change the value of "position" its saved correctly in the database. But the field only shows "0". Bug or feature?

When I change line 103 in CategoryAdmin.php from:

->add('position', 'integer', array('required' => false, 'data' => 0))

to:

->add('position', 'integer', array('required' => false))

everything works fine.

img_239_-_312x216 1

How to use classificationBundle in my owner entity

sorry, my question is how to use the bundle in my bundle for example i need to add category for an entity called course, how can i do that? i seen the doc and install it but i don't find how to add category in a specific entity

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.